diff --git a/core/chain_makers.go b/core/chain_makers.go index 66c9bb196..ef42514f6 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -446,16 +446,15 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine // Save pre state for proof generation // preState := statedb.Copy() - // TODO uncomment when the 2935 PR is merged - // if config.IsPrague(b.header.Number, b.header.Time) { - // if !config.IsPrague(b.parent.Number(), b.parent.Time()) { - // Transition case: insert all 256 ancestors - // InsertBlockHashHistoryAtEip2935Fork(statedb, b.header.Number.Uint64()-1, b.header.ParentHash, chainreader) - // } else { - // ProcessParentBlockHash(statedb, b.header.Number.Uint64()-1, b.header.ParentHash) - // } - // } - // Execute any user modifications to the block + // Pre-execution system calls. + if config.IsPrague(b.header.Number, b.header.Time) { + // EIP-2935 + blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase) + vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, cm.config, vm.Config{}) + ProcessParentBlockHash(b.header.ParentHash, vmenv, statedb) + } + + // Execute any user modifications to the block. if gen != nil { gen(i, b) } @@ -469,7 +468,7 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine panic(err) } - // Write state changes to db + // Write state changes to DB root, err := statedb.Commit(b.header.Number.Uint64(), config.IsEIP158(b.header.Number)) if err != nil { panic(fmt.Sprintf("state write error: %v", err)) diff --git a/params/protocol_params.go b/params/protocol_params.go index d3d22d91f..114c5056d 100644 --- a/params/protocol_params.go +++ b/params/protocol_params.go @@ -201,7 +201,7 @@ var ( // SystemAddress is where the system-transaction is sent from as per EIP-4788 SystemAddress = common.HexToAddress("0xfffffffffffffffffffffffffffffffffffffffe") // HistoryStorageAddress is where the historical block hashes are stored. - HistoryStorageAddress = common.HexToAddress("0x0aae40965e6800cd9b1f4b05ff21581047e3f91e") + HistoryStorageAddress = common.HexToAddress("0x0000F90827F1C53a10cb7A02335B175320002935") // HistoryStorageCode is the code with getters for historical block hashes. HistoryStorageCode = common.FromHex("3373fffffffffffffffffffffffffffffffffffffffe1460575767ffffffffffffffff5f3511605357600143035f3511604b575f35612000014311604b57611fff5f3516545f5260205ff35b5f5f5260205ff35b5f5ffd5b5f35611fff60014303165500") )