Skip to content

Commit

Permalink
eth/tracers: fix call nil OnSystemTxFixIntrinsicGas (#2851)
Browse files Browse the repository at this point in the history
  • Loading branch information
buddh0 authored Jan 13, 2025
1 parent 18000c4 commit d41d601
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
9 changes: 5 additions & 4 deletions eth/tracers/native/call_flat.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,11 @@ func newFlatCallTracer(ctx *tracers.Context, cfg json.RawMessage, chainConfig *p
ft := &flatCallTracer{tracer: t, ctx: ctx, config: config, chainConfig: chainConfig}
return &tracers.Tracer{
Hooks: &tracing.Hooks{
OnTxStart: ft.OnTxStart,
OnTxEnd: ft.OnTxEnd,
OnEnter: ft.OnEnter,
OnExit: ft.OnExit,
OnTxStart: ft.OnTxStart,
OnTxEnd: ft.OnTxEnd,
OnEnter: ft.OnEnter,
OnExit: ft.OnExit,
OnSystemTxFixIntrinsicGas: ft.OnSystemTxFixIntrinsicGas,
},
Stop: ft.Stop,
GetResult: ft.GetResult,
Expand Down
4 changes: 3 additions & 1 deletion eth/tracers/native/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@ func (t *muxTracer) OnLog(log *types.Log) {

func (t *muxTracer) OnSystemTxFixIntrinsicGas(intrinsicGas uint64) {
for _, t := range t.tracers {
t.OnSystemTxFixIntrinsicGas(intrinsicGas)
if t.OnSystemTxFixIntrinsicGas != nil {
t.OnSystemTxFixIntrinsicGas(intrinsicGas)
}
}
}

Expand Down
27 changes: 12 additions & 15 deletions eth/tracers/native/noop.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,18 @@ func newNoopTracer(ctx *tracers.Context, cfg json.RawMessage, chainConfig *param
t := &noopTracer{}
return &tracers.Tracer{
Hooks: &tracing.Hooks{
OnTxStart: t.OnTxStart,
OnTxEnd: t.OnTxEnd,
OnEnter: t.OnEnter,
OnExit: t.OnExit,
OnOpcode: t.OnOpcode,
OnFault: t.OnFault,
OnGasChange: t.OnGasChange,
OnBalanceChange: t.OnBalanceChange,
OnNonceChange: t.OnNonceChange,
OnCodeChange: t.OnCodeChange,
OnStorageChange: t.OnStorageChange,
OnLog: t.OnLog,
OnSystemTxFixIntrinsicGas: t.OnSystemTxFixIntrinsicGas,
OnTxStart: t.OnTxStart,
OnTxEnd: t.OnTxEnd,
OnEnter: t.OnEnter,
OnExit: t.OnExit,
OnOpcode: t.OnOpcode,
OnFault: t.OnFault,
OnGasChange: t.OnGasChange,
OnBalanceChange: t.OnBalanceChange,
OnNonceChange: t.OnNonceChange,
OnCodeChange: t.OnCodeChange,
OnStorageChange: t.OnStorageChange,
OnLog: t.OnLog,
},
GetResult: t.GetResult,
Stop: t.Stop,
Expand Down Expand Up @@ -90,8 +89,6 @@ func (*noopTracer) OnStorageChange(a common.Address, k, prev, new common.Hash) {

func (*noopTracer) OnLog(log *types.Log) {}

func (*noopTracer) OnSystemTxFixIntrinsicGas(intrinsicGas uint64) {}

// GetResult returns an empty json object.
func (t *noopTracer) GetResult() (json.RawMessage, error) {
return json.RawMessage(`{}`), nil
Expand Down

0 comments on commit d41d601

Please sign in to comment.