diff --git a/core/state_processor.go b/core/state_processor.go index b9ea5c4cc2..ed7c26946a 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -189,11 +189,13 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo // ProcessBeaconBlockRoot applies the EIP-4788 system call to the beacon block root // contract. This method is exported to be used in tests. func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *state.StateDB) { - if vmenv.Config.Tracer != nil && vmenv.Config.Tracer.OnSystemCallStart != nil { - vmenv.Config.Tracer.OnSystemCallStart() - } - if vmenv.Config.Tracer != nil && vmenv.Config.Tracer.OnSystemCallEnd != nil { - defer vmenv.Config.Tracer.OnSystemCallEnd() + if tracer := vmenv.Config.Tracer; tracer != nil { + if tracer.OnSystemCallStart != nil { + tracer.OnSystemCallStart() + } + if tracer.OnSystemCallEnd != nil { + defer tracer.OnSystemCallEnd() + } } // If EIP-4788 is enabled, we need to invoke the beaconroot storage contract with @@ -216,12 +218,12 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *stat // ProcessParentBlockHash stores the parent block hash in the history storage contract // as per EIP-2935. func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb *state.StateDB) { - if vmenv.Config.Tracer != nil { - if Config.Tracer.OnSystemCallStart != nil { - vmenv.Config.Tracer.OnSystemCallStart() + if tracer := vmenv.Config.Tracer; tracer != nil { + if tracer.OnSystemCallStart != nil { + tracer.OnSystemCallStart() } - if vmenv.Config.Tracer.OnSystemCallEnd != nil { - defer vmenv.Config.Tracer.OnSystemCallEnd() + if tracer.OnSystemCallEnd != nil { + defer tracer.OnSystemCallEnd() } }