mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
Apply suggestions from code review
Co-authored-by: Martin HS <martin@swende.se>
This commit is contained in:
parent
09ac094115
commit
1bf5bd80a3
3 changed files with 10 additions and 9 deletions
|
|
@ -81,7 +81,6 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
|||
ProcessBeaconBlockRoot(*beaconRoot, vmenv, statedb)
|
||||
}
|
||||
if p.config.IsPrague(block.Number(), block.Time()) {
|
||||
// This should not underflow as genesis block is not processed.
|
||||
ProcessParentBlockHash(block.ParentHash(), vmenv, statedb)
|
||||
}
|
||||
// Iterate over and process the individual transactions
|
||||
|
|
@ -217,11 +216,13 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *stat
|
|||
// ProcessParentBlockHash stores the parent block hash in the history storage contract
|
||||
// as per EIP-2935.
|
||||
func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb *state.StateDB) {
|
||||
if vmenv.Config.Tracer != nil && vmenv.Config.Tracer.OnSystemCallStart != nil {
|
||||
vmenv.Config.Tracer.OnSystemCallStart()
|
||||
}
|
||||
if vmenv.Config.Tracer != nil && vmenv.Config.Tracer.OnSystemCallEnd != nil {
|
||||
defer vmenv.Config.Tracer.OnSystemCallEnd()
|
||||
if vmenv.Config.Tracer != nil {
|
||||
if Config.Tracer.OnSystemCallStart != nil {
|
||||
vmenv.Config.Tracer.OnSystemCallStart()
|
||||
}
|
||||
if vmenv.Config.Tracer.OnSystemCallEnd != nil {
|
||||
defer vmenv.Config.Tracer.OnSystemCallEnd()
|
||||
}
|
||||
}
|
||||
|
||||
msg := &Message{
|
||||
|
|
|
|||
|
|
@ -557,10 +557,10 @@ func TestProcessParentBlockHash(t *testing.T) {
|
|||
|
||||
// make sure that the state is correct
|
||||
if have := getParentBlockHash(statedb, 1); have != hashA {
|
||||
t.Errorf("expected parent hash %v, got %v", hashA, have)
|
||||
t.Errorf("want parent hash %v, have %v", hashA, have)
|
||||
}
|
||||
if have := getParentBlockHash(statedb, 0); have != hashB {
|
||||
t.Errorf("expected parent hash %v, got %v", hashB, have)
|
||||
t.Errorf("want parent hash %v, have %v", hashB, have)
|
||||
}
|
||||
}
|
||||
t.Run("MPT", func(t *testing.T) {
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block,
|
|||
vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, eth.blockchain.Config(), vm.Config{})
|
||||
core.ProcessBeaconBlockRoot(*beaconRoot, vmenv, statedb)
|
||||
}
|
||||
// If prague hardfork, Insert parent block hash in the state as per EIP-2935.
|
||||
// If prague hardfork, insert parent block hash in the state as per EIP-2935.
|
||||
if eth.blockchain.Config().IsPrague(block.Number(), block.Time()) {
|
||||
context := core.NewEVMBlockContext(block.Header(), eth.blockchain, nil)
|
||||
vmenv := vm.NewEVM(context, vm.TxContext{}, statedb, eth.blockchain.Config(), vm.Config{})
|
||||
|
|
|
|||
Loading…
Reference in a new issue