eth: make tracers respect pre-EIP158/161 rules #18503 (#1250)

This commit is contained in:
Daniel Liu 2025-07-26 18:17:48 +08:00 committed by GitHub
parent db48539c17
commit fd96101af7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -259,7 +259,8 @@ func (api *DebugAPI) traceChain(ctx context.Context, start, end *types.Block, co
log.Warn("Tracing failed", "hash", tx.Hash(), "block", task.block.NumberU64(), "err", err)
break
}
task.statedb.Finalise(true)
// Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect
task.statedb.Finalise(api.eth.blockchain.Config().IsEIP158(task.block.Number()))
task.results[i] = &txTraceResult{Result: res}
}
// Stream the result back to the user or abort on teardown
@ -523,7 +524,8 @@ func (api *DebugAPI) traceBlock(ctx context.Context, block *types.Block, config
break
}
// Finalize the state so any modifications are written to the trie
statedb.Finalise(true)
// Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect
statedb.Finalise(vmenv.ChainConfig().IsEIP158(block.Number()))
}
close(jobs)
pend.Wait()
@ -820,6 +822,7 @@ func (api *DebugAPI) computeTxEnv(blockHash common.Hash, txIndex int, reexec uin
}
}
// Ensure any modifications are committed to the state
statedb.Finalise(true)
// Only delete empty objects if EIP158/161 (a.k.a Spurious Dragon) is in effect
statedb.Finalise(api.eth.blockchain.Config().IsEIP158(block.Number()))
return nil, vm.BlockContext{}, nil, fmt.Errorf("tx index %d out of range for block %x", txIndex, blockHash)
}