From 710657305d3c23d9983a04034e92fa804aa42fa7 Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Tue, 9 Jul 2024 18:29:14 +0200 Subject: [PATCH] fix stateAtTransaction --- eth/state_accessor.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eth/state_accessor.go b/eth/state_accessor.go index 372c76f496..11ca44f767 100644 --- a/eth/state_accessor.go +++ b/eth/state_accessor.go @@ -239,6 +239,12 @@ 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 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{}) + core.ProcessParentBlockHash(statedb, vmenv, block.ParentHash()) + } if txIndex == 0 && len(block.Transactions()) == 0 { return nil, vm.BlockContext{}, statedb, release, nil }