fix up odds-and-ends

This commit is contained in:
Jared Wasinger 2025-10-17 19:14:43 +08:00
parent e481a1a7d1
commit 9f9f5af6fa
3 changed files with 10 additions and 19 deletions

View file

@ -2149,6 +2149,10 @@ func (bc *BlockChain) ProcessBlock(parentRoot common.Hash, block *types.Block, s
// Process block using the parent state as reference point
if constructBALForTesting {
balTracer, bc.cfg.VmConfig.Tracer = NewBlockAccessListTracer()
defer func() {
bc.cfg.VmConfig.Tracer = nil
}()
}
// Process block using the parent state as reference point
pstart := time.Now()

View file

@ -118,7 +118,6 @@ type StateDB struct {
// The tx context and all occurred logs in the scope of transaction.
thash common.Hash
txIndex int
sender common.Address
// block access list modifications will be recorded with this index.
// 0 - state access before transaction execution
@ -837,9 +836,6 @@ func (s *StateDB) GetRefund() uint64 {
// Finalise finalises the state by removing the destructed objects and clears
// the journal as well as the refunds. Finalise, however, will not push any updates
// into the tries just yet. Only IntermediateRoot or Commit will do that.
//
// If EnableStateDiffRecording has been called, it returns a state diff containing
// the state which was mutated since the previous invocation of Finalise. Otherwise, nil.
func (s *StateDB) Finalise(deleteEmptyObjects bool) {
addressesToPrefetch := make([]common.Address, 0, len(s.journal.dirties))
for addr := range s.journal.dirties {
@ -865,7 +861,8 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
} else {
obj.finalise()
s.markUpdate(addr)
} // At this point, also ship the address off to the precacher. The precacher
}
// At this point, also ship the address off to the precacher. The precacher
// will start loading tries, and when the change is eventually committed,
// the commit-phase will be a lot faster
addressesToPrefetch = append(addressesToPrefetch, addr) // Copy needed for closure
@ -875,7 +872,6 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
log.Error("Failed to prefetch addresses", "addresses", len(addressesToPrefetch), "err", err)
}
}
// Invalidate journal because reverting across transactions is not allowed.
s.clearJournalAndRefund()
}
@ -884,7 +880,7 @@ func (s *StateDB) Finalise(deleteEmptyObjects bool) {
// It is called in between transactions to get the root hash that
// goes into transaction receipts.
func (s *StateDB) IntermediateRoot(deleteEmptyObjects bool) common.Hash {
// FinaliseIdxChanges all the dirty storage states and write them into the tries
// Finalise all the dirty storage states and write them into the tries
s.Finalise(deleteEmptyObjects)
// Initialize the trie if it's not constructed yet. If the prefetch
@ -1098,11 +1094,6 @@ func (s *StateDB) SetAccessListIndex(idx int) {
s.balIndex = idx
}
// SetTxSender sets the sender of the currently-executing transaction.
func (s *StateDB) SetTxSender(sender common.Address) {
s.sender = sender
}
func (s *StateDB) clearJournalAndRefund() {
s.journal.reset()
s.refund = 0

View file

@ -79,7 +79,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
)
// Apply pre-execution system calls.
var tracingStateDB vm.StateDB = statedb
var tracingStateDB = vm.StateDB(statedb)
if hooks := cfg.Tracer; hooks != nil {
tracingStateDB = state.NewHookedState(statedb, hooks)
}
@ -113,9 +113,6 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
allLogs = append(allLogs, receipt.Logs...)
}
// TODO: how do we signal to the BAL tracer that we are computing post-tx state changes here?
// if there are no txs in the block, then it will just record these state diffs at idx 0
// Read requests if Prague is enabled.
var requests [][]byte
if config.IsPrague(block.Number(), block.Time()) {
@ -126,11 +123,11 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
}
// EIP-7002
if err := ProcessWithdrawalQueue(&requests, evm); err != nil {
return nil, err
return nil, fmt.Errorf("failed to process withdrawal queue: %w", err)
}
// EIP-7251
if err := ProcessConsolidationQueue(&requests, evm); err != nil {
return nil, err
return nil, fmt.Errorf("failed to process consolidation queue: %w", err)
}
}
@ -166,7 +163,6 @@ func ApplyTransactionWithEVM(msg *Message, gp *GasPool, statedb *state.StateDB,
if err != nil {
return nil, err
}
// Update the state with pending changes.
var root []byte
if evm.ChainConfig().IsByzantium(blockNumber) {