Skip to content

Commit

Permalink
core: add EIP-2935 support in GenerateChain
Browse files Browse the repository at this point in the history
  • Loading branch information
fjl committed Dec 17, 2024
1 parent 3c208cd commit 9cdbb3f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions core/chain_makers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 9cdbb3f

Please sign in to comment.