Skip to content

Commit 578065e

Browse files
committed
implementing PR ethereum#23558 from ethereum/go-ethereum
1 parent 9f1572a commit 578065e

File tree

9 files changed

+30
-30
lines changed

9 files changed

+30
-30
lines changed

cmd/evm/disasm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ func disasmCmd(ctx *cli.Context) error {
4646
case ctx.GlobalIsSet(InputFlag.Name):
4747
in = ctx.GlobalString(InputFlag.Name)
4848
default:
49-
return errors.New("Missing filename or --input value")
49+
return errors.New("missing filename or --input value")
5050
}
5151

5252
code := strings.TrimSpace(in)

cmd/evm/internal/t8ntool/flags.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ var (
3030
Name: "trace",
3131
Usage: "Output full trace logs to files <txhash>.jsonl",
3232
}
33-
TraceDisableMemoryFlag = cli.BoolFlag{
33+
TraceDisableMemoryFlag = cli.BoolTFlag{
3434
Name: "trace.nomemory",
3535
Usage: "Disable full memory dump in traces",
3636
}
3737
TraceDisableStackFlag = cli.BoolFlag{
3838
Name: "trace.nostack",
3939
Usage: "Disable stack output in traces",
4040
}
41-
TraceDisableReturnDataFlag = cli.BoolFlag{
41+
TraceDisableReturnDataFlag = cli.BoolTFlag{
4242
Name: "trace.noreturndata",
4343
Usage: "Disable return data output in traces",
4444
}

cmd/evm/internal/t8ntool/transition.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ func Main(ctx *cli.Context) error {
9999
if ctx.Bool(TraceFlag.Name) {
100100
// Configure the EVM logger
101101
logConfig := &vm.LogConfig{
102-
DisableStack: ctx.Bool(TraceDisableStackFlag.Name),
103-
DisableMemory: ctx.Bool(TraceDisableMemoryFlag.Name),
104-
DisableReturnData: ctx.Bool(TraceDisableReturnDataFlag.Name),
105-
Debug: true,
102+
DisableStack: ctx.Bool(TraceDisableStackFlag.Name),
103+
EnableMemory: !ctx.Bool(TraceDisableMemoryFlag.Name),
104+
EnableReturnData: !ctx.Bool(TraceDisableReturnDataFlag.Name),
105+
Debug: true,
106106
}
107107
var prevFile *os.File
108108
// This one closes the last file

cmd/evm/main.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ var (
113113
Name: "receiver",
114114
Usage: "The transaction receiver (execution context)",
115115
}
116-
DisableMemoryFlag = cli.BoolFlag{
116+
DisableMemoryFlag = cli.BoolTFlag{
117117
Name: "nomemory",
118118
Usage: "disable memory output",
119119
}
@@ -125,9 +125,9 @@ var (
125125
Name: "nostorage",
126126
Usage: "disable storage output",
127127
}
128-
DisableReturnDataFlag = cli.BoolFlag{
128+
DisableReturnDataFlag = cli.BoolTFlag{
129129
Name: "noreturndata",
130-
Usage: "disable return data output",
130+
Usage: "enable return data output",
131131
}
132132
EVMInterpreterFlag = cli.StringFlag{
133133
Name: "vm.evm",

cmd/evm/runner.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,11 @@ func runCmd(ctx *cli.Context) error {
110110
glogger.Verbosity(log.Lvl(ctx.GlobalInt(VerbosityFlag.Name)))
111111
log.Root().SetHandler(glogger)
112112
logconfig := &vm.LogConfig{
113-
DisableMemory: ctx.GlobalBool(DisableMemoryFlag.Name),
114-
DisableStack: ctx.GlobalBool(DisableStackFlag.Name),
115-
DisableStorage: ctx.GlobalBool(DisableStorageFlag.Name),
116-
DisableReturnData: ctx.GlobalBool(DisableReturnDataFlag.Name),
117-
Debug: ctx.GlobalBool(DebugFlag.Name),
113+
EnableMemory: !ctx.GlobalBool(DisableMemoryFlag.Name),
114+
DisableStack: ctx.GlobalBool(DisableStackFlag.Name),
115+
DisableStorage: ctx.GlobalBool(DisableStorageFlag.Name),
116+
EnableReturnData: !ctx.GlobalBool(DisableReturnDataFlag.Name),
117+
Debug: ctx.GlobalBool(DebugFlag.Name),
118118
}
119119

120120
var (

cmd/evm/staterunner.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ func stateTestCmd(ctx *cli.Context) error {
7070

7171
// Configure the EVM logger
7272
config := &vm.LogConfig{
73-
DisableMemory: ctx.GlobalBool(DisableMemoryFlag.Name),
74-
DisableStack: ctx.GlobalBool(DisableStackFlag.Name),
75-
DisableStorage: ctx.GlobalBool(DisableStorageFlag.Name),
76-
DisableReturnData: ctx.GlobalBool(DisableReturnDataFlag.Name),
73+
EnableMemory: !ctx.GlobalBool(DisableMemoryFlag.Name),
74+
DisableStack: ctx.GlobalBool(DisableStackFlag.Name),
75+
DisableStorage: ctx.GlobalBool(DisableStorageFlag.Name),
76+
EnableReturnData: !ctx.GlobalBool(DisableReturnDataFlag.Name),
7777
}
7878
var (
7979
tracer vm.Tracer

core/vm/logger.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ func (s Storage) Copy() Storage {
4545

4646
// LogConfig are the configuration options for structured logger the EVM
4747
type LogConfig struct {
48-
DisableMemory bool // disable memory capture
49-
DisableStack bool // disable stack capture
50-
DisableStorage bool // disable storage capture
51-
DisableReturnData bool // disable return data capture
52-
Debug bool // print output during capture end
53-
Limit int // maximum length of output, but zero means unlimited
48+
EnableMemory bool // enable memory capture
49+
DisableStack bool // disable stack capture
50+
DisableStorage bool // disable storage capture
51+
EnableReturnData bool // enable return data capture
52+
Debug bool // print output during capture end
53+
Limit int // maximum length of output, but zero means unlimited
5454
// Chain overrides, can be used to execute a trace using future fork rules
5555
Overrides ctypes.ChainConfigurator `json:"overrides,omitempty"`
5656
}
@@ -159,7 +159,7 @@ func (l *StructLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost ui
159159
}
160160
// Copy a snapshot of the current memory state to a new buffer
161161
var mem []byte
162-
if !l.cfg.DisableMemory {
162+
if !l.cfg.EnableMemory {
163163
mem = make([]byte, len(memory.Data()))
164164
copy(mem, memory.Data())
165165
}
@@ -198,7 +198,7 @@ func (l *StructLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost ui
198198
storage = l.storage[contract.Address()].Copy()
199199
}
200200
var rdata []byte
201-
if !l.cfg.DisableReturnData {
201+
if !l.cfg.EnableReturnData {
202202
rdata = make([]byte, len(rData))
203203
copy(rdata, rData)
204204
}

core/vm/logger_json.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ func (l *JSONLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost uint
6565
RefundCounter: env.StateDB.GetRefund(),
6666
Err: err,
6767
}
68-
if !l.cfg.DisableMemory {
68+
if !l.cfg.EnableMemory {
6969
log.Memory = memory.Data()
7070
}
7171
if !l.cfg.DisableStack {
@@ -76,7 +76,7 @@ func (l *JSONLogger) CaptureState(env *EVM, pc uint64, op OpCode, gas, cost uint
7676
}
7777
log.Stack = logstack
7878
}
79-
if !l.cfg.DisableReturnData {
79+
if !l.cfg.EnableReturnData {
8080
log.ReturnData = rData
8181
}
8282
l.encoder.Encode(log)

tests/state_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ func withTrace(t *testing.T, gasLimit uint64, test func(vm.Config) error) {
133133
}
134134
buf := new(bytes.Buffer)
135135
w := bufio.NewWriter(buf)
136-
tracer := vm.NewJSONLogger(&vm.LogConfig{DisableMemory: true}, w)
136+
tracer := vm.NewJSONLogger(&vm.LogConfig{}, w)
137137
config.Debug, config.Tracer = true, tracer
138138
err2 := test(config)
139139
if !reflect.DeepEqual(err, err2) {

0 commit comments

Comments
 (0)