Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth/tracers: fix call nil OnSystemTxFixIntrinsicGas #2851

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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) {}
zzzckck marked this conversation as resolved.
Show resolved Hide resolved

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