diff --git a/core/state_processor.go b/core/state_processor.go index 5a86931106..b9ea5c4cc2 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -81,7 +81,6 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg ProcessBeaconBlockRoot(*beaconRoot, vmenv, statedb) } if p.config.IsPrague(block.Number(), block.Time()) { - // This should not underflow as genesis block is not processed. ProcessParentBlockHash(block.ParentHash(), vmenv, statedb) } // Iterate over and process the individual transactions @@ -217,11 +216,13 @@ 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 && 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 vmenv.Config.Tracer != nil { + if Config.Tracer.OnSystemCallStart != nil { + vmenv.Config.Tracer.OnSystemCallStart() + } + if vmenv.Config.Tracer.OnSystemCallEnd != nil { + defer vmenv.Config.Tracer.OnSystemCallEnd() + } } msg := &Message{ diff --git a/core/state_processor_test.go b/core/state_processor_test.go index 4315093369..bf29fb9773 100644 --- a/core/state_processor_test.go +++ b/core/state_processor_test.go @@ -557,10 +557,10 @@ func TestProcessParentBlockHash(t *testing.T) { // make sure that the state is correct if have := getParentBlockHash(statedb, 1); have != hashA { - t.Errorf("expected parent hash %v, got %v", hashA, have) + t.Errorf("want parent hash %v, have %v", hashA, have) } if have := getParentBlockHash(statedb, 0); have != hashB { - t.Errorf("expected parent hash %v, got %v", hashB, have) + t.Errorf("want parent hash %v, have %v", hashB, have) } } t.Run("MPT", func(t *testing.T) { diff --git a/eth/state_accessor.go b/eth/state_accessor.go index 94c4977376..90f7c01391 100644 --- a/eth/state_accessor.go +++ b/eth/state_accessor.go @@ -239,7 +239,7 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block, vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, eth.blockchain.Config(), vm.Config{}) core.ProcessBeaconBlockRoot(*beaconRoot, vmenv, statedb) } - // If prague hardfork, Insert parent block hash in the state as per EIP-2935. + // If prague hardfork, insert parent block hash in the state as per EIP-2935. if eth.blockchain.Config().IsPrague(block.Number(), block.Time()) { context := core.NewEVMBlockContext(block.Header(), eth.blockchain, nil) vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, eth.blockchain.Config(), vm.Config{})