From 912a13700c5aa95a2e167bb7f291bbab711cdc85 Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Sun, 13 Oct 2024 18:51:51 +0200 Subject: [PATCH] core: enable EIP-2935 in chain maker (#30575) --- core/chain_makers.go | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/core/chain_makers.go b/core/chain_makers.go index 0ceddf8b63..586979e772 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -462,16 +462,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) } @@ -485,7 +484,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))