From 9cdbb3f2e279d8c9a0acd3111ba9189bd81ea16c Mon Sep 17 00:00:00 2001 From: Felix Lange Date: Tue, 17 Dec 2024 12:55:45 +0100 Subject: [PATCH] core: add EIP-2935 support in GenerateChain --- core/chain_makers.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/chain_makers.go b/core/chain_makers.go index 97c785d52b48..58d0b24ff528 100644 --- a/core/chain_makers.go +++ b/core/chain_makers.go @@ -330,6 +330,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse b.header.Difficulty = big.NewInt(0) } } + // Mutate the state and block according to any hard-fork specs if daoBlock := config.DAOForkBlock; daoBlock != nil { limit := new(big.Int).Add(daoBlock, params.DAOForkExtraRange) @@ -342,6 +343,15 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse if config.DAOForkSupport && config.DAOForkBlock != nil && config.DAOForkBlock.Cmp(b.header.Number) == 0 { misc.ApplyDAOHardFork(statedb) } + + if config.IsPrague(b.header.Number, b.header.Time) { + // EIP-2935 + blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase) + blockContext.Random = &common.Hash{} // enable post-merge instruction set + evm := vm.NewEVM(blockContext, statedb, cm.config, vm.Config{}) + ProcessParentBlockHash(b.header.ParentHash, evm) + } + // Execute any user modifications to the block if gen != nil { gen(i, b)