diff --git a/cmd/evm/internal/t8ntool/file_tracer.go b/cmd/evm/internal/t8ntool/file_tracer.go index 38fc35bd32..b1e642b70d 100644 --- a/cmd/evm/internal/t8ntool/file_tracer.go +++ b/cmd/evm/internal/t8ntool/file_tracer.go @@ -20,7 +20,6 @@ import ( "encoding/json" "fmt" "io" - "math/big" "os" "path/filepath" @@ -115,38 +114,12 @@ func (l *fileWritingTracer) OnTxEnd(receipt *types.Receipt, err error) { } func (l *fileWritingTracer) hooks() *tracing.Hooks { - return &tracing.Hooks{ - OnTxStart: l.OnTxStart, - OnTxEnd: l.OnTxEnd, - OnEnter: func(depth int, typ byte, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { - if l.inner != nil && l.inner.OnEnter != nil { - l.inner.OnEnter(depth, typ, from, to, input, gas, value) - } - }, - OnExit: func(depth int, output []byte, gasUsed uint64, err error, reverted bool) { - if l.inner != nil && l.inner.OnExit != nil { - l.inner.OnExit(depth, output, gasUsed, err, reverted) - } - }, - OnOpcode: func(pc uint64, op byte, gas, cost uint64, scope tracing.OpContext, rData []byte, depth int, err error) { - if l.inner != nil && l.inner.OnOpcode != nil { - l.inner.OnOpcode(pc, op, gas, cost, scope, rData, depth, err) - } - }, - OnFault: func(pc uint64, op byte, gas, cost uint64, scope tracing.OpContext, depth int, err error) { - if l.inner != nil && l.inner.OnFault != nil { - l.inner.OnFault(pc, op, gas, cost, scope, depth, err) - } - }, - OnSystemCallStart: func() { - if l.inner != nil && l.inner.OnSystemCallStart != nil { - l.inner.OnSystemCallStart() - } - }, - OnSystemCallEnd: func() { - if l.inner != nil && l.inner.OnSystemCallEnd != nil { - l.inner.OnSystemCallEnd() - } - }, - } + // Shallow copy + tmp := *l.inner + hooks := &tmp + + hooks.OnTxStart = l.OnTxStart + hooks.OnTxEnd = l.OnTxEnd + + return hooks } diff --git a/eth/tracers/logger/logger_json.go b/eth/tracers/logger/logger_json.go index 52ac3945d4..0bd11d7993 100644 --- a/eth/tracers/logger/logger_json.go +++ b/eth/tracers/logger/logger_json.go @@ -69,11 +69,11 @@ func NewJSONLogger(cfg *Config, writer io.Writer) *tracing.Hooks { l.cfg = &Config{} } l.hooks = &tracing.Hooks{ - OnTxStart: l.OnTxStart, - OnSystemCallStart: l.onSystemCallStart, - OnExit: l.OnExit, - OnOpcode: l.OnOpcode, - OnFault: l.OnFault, + OnTxStart: l.OnTxStart, + OnSystemCallStartV2: l.onSystemCallStartV2, + OnExit: l.OnExit, + OnOpcode: l.OnOpcode, + OnFault: l.OnFault, } return l.hooks } @@ -86,12 +86,12 @@ func NewJSONLoggerWithCallFrames(cfg *Config, writer io.Writer) *tracing.Hooks { l.cfg = &Config{} } l.hooks = &tracing.Hooks{ - OnTxStart: l.OnTxStart, - OnSystemCallStart: l.onSystemCallStart, - OnEnter: l.OnEnter, - OnExit: l.OnExit, - OnOpcode: l.OnOpcode, - OnFault: l.OnFault, + OnTxStart: l.OnTxStart, + OnSystemCallStartV2: l.onSystemCallStartV2, + OnEnter: l.OnEnter, + OnExit: l.OnExit, + OnOpcode: l.OnOpcode, + OnFault: l.OnFault, } return l.hooks } @@ -127,7 +127,7 @@ func (l *jsonLogger) OnOpcode(pc uint64, op byte, gas, cost uint64, scope tracin l.encoder.Encode(log) } -func (l *jsonLogger) onSystemCallStart() { +func (l *jsonLogger) onSystemCallStartV2(ctx *tracing.VMContext) { // Process no events while in system call. hooks := *l.hooks *l.hooks = tracing.Hooks{