Skip to content

Commit f4817b7

Browse files
authored
core: initialize tracer before DAO fork logic (#33214)
`StateDB` lacks recording functionality, so it has been replaced with `tractStateDB` and advanced
1 parent e0d81d1 commit f4817b7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

core/state_processor.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,20 +69,21 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
6969
gp = new(GasPool).AddGas(block.GasLimit())
7070
)
7171

72+
var tracingStateDB = vm.StateDB(statedb)
73+
if hooks := cfg.Tracer; hooks != nil {
74+
tracingStateDB = state.NewHookedState(statedb, hooks)
75+
}
76+
7277
// Mutate the block and state according to any hard-fork specs
7378
if config.DAOForkSupport && config.DAOForkBlock != nil && config.DAOForkBlock.Cmp(block.Number()) == 0 {
74-
misc.ApplyDAOHardFork(statedb)
79+
misc.ApplyDAOHardFork(tracingStateDB)
7580
}
7681
var (
7782
context vm.BlockContext
7883
signer = types.MakeSigner(config, header.Number, header.Time)
7984
)
8085

8186
// Apply pre-execution system calls.
82-
var tracingStateDB = vm.StateDB(statedb)
83-
if hooks := cfg.Tracer; hooks != nil {
84-
tracingStateDB = state.NewHookedState(statedb, hooks)
85-
}
8687
context = NewEVMBlockContext(header, p.chain, nil)
8788
evm := vm.NewEVM(context, tracingStateDB, config, cfg)
8889

0 commit comments

Comments
 (0)