Skip to content

Commit 912a137

Browse files
fjlholiman
authored andcommitted
core: enable EIP-2935 in chain maker (#30575)
1 parent 54a4b1d commit 912a137

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

core/chain_makers.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,15 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
462462
// Save pre state for proof generation
463463
// preState := statedb.Copy()
464464

465-
// TODO uncomment when the 2935 PR is merged
466-
// if config.IsPrague(b.header.Number, b.header.Time) {
467-
// if !config.IsPrague(b.parent.Number(), b.parent.Time()) {
468-
// Transition case: insert all 256 ancestors
469-
// InsertBlockHashHistoryAtEip2935Fork(statedb, b.header.Number.Uint64()-1, b.header.ParentHash, chainreader)
470-
// } else {
471-
// ProcessParentBlockHash(statedb, b.header.Number.Uint64()-1, b.header.ParentHash)
472-
// }
473-
// }
474-
// Execute any user modifications to the block
465+
// Pre-execution system calls.
466+
if config.IsPrague(b.header.Number, b.header.Time) {
467+
// EIP-2935
468+
blockContext := NewEVMBlockContext(b.header, cm, &b.header.Coinbase)
469+
vmenv := vm.NewEVM(blockContext, vm.TxContext{}, statedb, cm.config, vm.Config{})
470+
ProcessParentBlockHash(b.header.ParentHash, vmenv, statedb)
471+
}
472+
473+
// Execute any user modifications to the block.
475474
if gen != nil {
476475
gen(i, b)
477476
}
@@ -485,7 +484,7 @@ func GenerateVerkleChain(config *params.ChainConfig, parent *types.Block, engine
485484
panic(err)
486485
}
487486

488-
// Write state changes to db
487+
// Write state changes to DB.
489488
root, err := statedb.Commit(b.header.Number.Uint64(), config.IsEIP158(b.header.Number))
490489
if err != nil {
491490
panic(fmt.Sprintf("state write error: %v", err))

0 commit comments

Comments
 (0)