Skip to content

debug_traceTransaction with prestateTracer incorrectly handles EIP-6780 SELFDESTRUCT in diffMode #33049

@ella-quicknode

Description

@ella-quicknode

System information

Geth version: v1.16.5-stable
OS & Version: Linux (Docker) Ubuntu 22.04.5 LTS
Network: Sepolia

Expected behaviour

After EIP-6780 (Cancun), when a contract calls SELFDESTRUCT in a different transaction than its creation, the contract should remain in state (code/storage persist, only balance transferred). The debug_traceTransaction API with prestateTracer in diffMode should show the contract in both pre and post states.

Actual behaviour

The contract appears in pre state but is missing from post state, suggesting complete deletion (pre-EIP-6780 behavior). However, eth_getCode confirms the contract code still exists on-chain, proving EIP-6780 is working correctly in execution.

Steps to reproduce the behaviour

Test on Sepolia with a post-Cancun SELFDESTRUCT transaction:
Transaction: 0xdcf1e7f23ec841e83c3a1eeca453d8d5465b1601d4a2f41edbbc22e3ee94b6cc
Block: 5189690 (0x4f303a)
Contract: 0xca41568b1b33cd7de3278406105629e4d5a5b624
Block timestamp: 1706690280 (2024-01-31 08:38:00) (after Cancun activation at 1706655072 (2024-01-30 22:51:12))

Node logs showed cancun time:

INFO [10-20|18:18:52.601]  - Cancun:                      @1706655072 blob: (target: 3, max: 6, fraction: 3338477)

repro:

  • Result: Contract 0xca41568b1b33cd7de3278406105629e4d5a5b624
  • appears in "pre" but NOT in "post"
  • In tenderly worked correctly
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"debug_traceTransaction",
    "params":[
      "0xdcf1e7f23ec841e83c3a1eeca453d8d5465b1601d4a2f41edbbc22e3ee94b6cc",
      {
        "tracer": "prestateTracer",
        "tracerConfig": {"diffMode": true}
      }
    ],
    "id":1
  }'
  • verified the contract still exists
curl -X POST http://localhost:8545 \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc":"2.0",
    "method":"eth_getCode",
    "params":["0xca41568b1b33cd7de3278406105629e4d5a5b624", "0x4f303b"],
    "id":1
  }'

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions