Repository navigation
eth/tracers: port the upstream supply tracer end-to-end tests #2904
Description
Found while reviewing #2833 (the EIP-8246 selfdestruct-burn fix for #2832). This tree never ported go-ethereum's supply live-tracer end-to-end tests: upstream has eth/tracers/internal/tracetest/supply_test.go since the tracer landed (go-ethereum ethereum#29347, c9e0b3105b), while this tree only has the hook-level table tests added by #2833 in eth/tracers/live/supply_test.go.
core/state/statedb_hooked_test.go:31 still points at the missing test:
// (There is also a higher-level test in eth/tracers: TestSupplySelfDestruct )Scope
Port TestSupplySelfdestruct and TestSupplySelfdestructItselfAndRevert - the two cases that drive burn.misc end to end - to eth/tracers/internal/tracetest/supply_test.go, adapted to this tree, plus the issuance/fee cases (TestSupplyOmittedFields, TestSupplyGenesisAlloc, TestSupplyEip1559Burn, TestSupplyWithdrawals) as far as this tree supports them (there are no beacon withdrawals here).
Blockers (verified while planning the port)
- No beacon merge.
core.BlockGenhas noSetPoS()(core/chain_makers.go), and there is nocore.SystemContractAllocs(). Upstream's tests depend on both (b.SetPoS(),Alloc: core.SystemContractAllocs()). - Different constructor. Here
core.NewBlockChain(db, cacheConfig, genesis, engine, vmConfig); upstream usescore.NewBlockChain(db, genesis, engine, options). The tracer is attached throughvm.Config{Tracer: hooks}. - Legacy SELFDESTRUCT is unreachable.
enable6780replaces the shared jump-table slot, soopSelfdestructnever executes even withCancunBlock == nil(established while working on fix(core/state,eth/tracers): report the selfdestruct burn from the state layer #2870). Upstream's pre-Cancun expectations (Misc = 5 gweiinTestSupplySelfdestruct;Misc = 5 ETHwith B's balance ending at zero inTestSupplySelfdestructItselfAndRevert) cannot be reproduced here, so the expected values and the state assertions have to be recomputed under 6780-only semantics. - Missing helpers.
eth/tracers/internal/tracetesthas neithertestSupplyTracer(chain generation plus tracer output scrape) norcompareAsJSON; both have to be added (~50 lines) together with the two contract bytecode blobs the selfdestruct cases use.
Why a separate change
#2833 only needed hook-level coverage for the EIP-8246 accounting, and the end-to-end expectations will shift again once #2870 (state-layer burn accounting) lands. Adding the port there would have meant rewriting it inside an already reviewed PR.
Acceptance
eth/tracers/internal/tracetest/supply_test.goexists andgo test ./eth/tracers/internal/tracetest/ -run TestSupply -count=1passes.- Expectations that diverge from upstream carry a comment explaining why (6780-only selfdestruct, no PoS, no withdrawals).
- The stale reference in
core/state/statedb_hooked_test.gois updated or removed.
References
- go-ethereum Supply delta live tracer ethereum/go-ethereum#29347 (
c9e0b3105b, supply tracer and its tests) - fix(eth/tracers): skip the EIP-8246 selfdestruct burn #35219, close #2832 #2833 (hook-level tests:
baa9c32659) - fix(core/state,eth/tracers): report the selfdestruct burn from the state layer #2870 (state-layer burn accounting; will change the numeric expectations)
Activity
test(eth/tracers): port the supply tracer end-to-end tests ethereum#2…
test(eth/tracers): port the supply tracer end-to-end tests ethereum#2…
test(eth/tracers): port the supply tracer end-to-end tests ethereum#2…