Skip to content

eth/tracers: supply tracer counts the EIP-8246 selfdestruct as a burn #2832

Closed

Description

@gzliudan

Summary

The supply live tracer (--vmtrace supply) counts a selfdestruct-to-self as
burn.misc whenever the SELFDESTRUCT hook fires with from == to and a
non-zero balance. Since EIP-8246 (Amsterdam) preserves that balance instead of
burning it, the tracer over-reports the burn on Amsterdam chains.

Where it goes wrong

eth/tracers/live/supply.go, OnEnter:

if vm.OpCode(typ) == vm.SELFDESTRUCT && from == to && value.Cmp(common.Big0) == 1 {
    call.burn = value
}

The check predates EIP-8246 and has no fork gate. The EIP-8246 state and hook
changes do not cover it: hookedStateDB.Finalise no longer emits
BalanceDecreaseSelfdestructBurn on Amsterdam, and the EIP-7708 burn logs are
gone, but this path infers the burn from the OnEnter event instead of a
balance hook, so it still accounts the preserved balance as burnt.

Upstream

go-ethereum has the same code and the same latent bug. Its EIP-8246 commit
(go-ethereum ethereum#35219) does not touch eth/tracers/, and its selfdestruct supply
test runs with params.TestChainConfig, where Cancun and Amsterdam are unset,
so the path was never exercised under the new rules. There is no upstream fix
to port, but upstream's tracer already carries the plumbing needed to gate the
check: a chainConfig *params.ChainConfig field filled by the
OnBlockchainInit hook (used there for blob fees). This repository dropped
both when the blob-fee code was removed.

Proposed fix

  • Restore chainConfig and the OnBlockchainInit hook in the supply tracer.
    core/blockchain.go already invokes OnBlockchainInit for every live tracer.
  • Cache IsAmsterdam(block.Number) in OnBlockStart and only record
    call.burn while it is false. This repository's forks are block-based, so
    the fork check needs the block number only.
  • Treat a missing chain config as "not Amsterdam", keeping the current
    behaviour instead of silently dropping burn accounting.
  • Add tests: Amsterdam active (no burn), fork block boundary, pre-Amsterdam
    (burn still reported), and a reverted selfdestruct (never counted).

Impact

Observability only, no consensus change. Production XDC networks do not
schedule Amsterdam, so the affected set is an Amsterdam-enabled dev/test chain
with --vmtrace supply enabled.

Relation to other work

EIP-8246 itself is tracked in #2766. This issue only fixes the tracer; the
consensus change is independent of it.

Activity

  1. added 10 commits that reference this issue on Oct 20, 2026
    bb3f04d
    c110369
    cd6b8a0
    194468c
    e0f3542
    568b653
    f439b84
    43e7fc7
    1021cfc
    c2725ee
  2. gzliudan commented on Oct 28, 2026

    @gzliudan
    CollaboratorAuthor

    Fixed by #2833, merged into dev-upgrade as c2725ee4de. The supply live tracer accounts the self-destruct burn from the BalanceDecreaseSelfdestructBurn event alone (eth/tracers/live/supply.go:183), so the EIP-8246 shape is no longer double counted. Closing manually: #2833 targets dev-upgrade, not the default branch, so its Closes #2832 keyword did not take effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions