Skip to content

Align debug_trace* opcode tracer with execution-apis#762 spec #12040

Description

@manusw7

Summary

execution-apis#762 (merged) standardizes the default opcode (struct) logger output for debug_traceTransaction, debug_traceBlockByNumber, and debug_traceBlockByHash. It is a spec + conformance-test standardization (not a hard fork), but we have a few small divergences worth aligning for cross-client conformance.

Nethermind already approved the spec direction in review (no concerns beyond reexec, which was dropped), and the streaming/field-order concern raised there is already covered by #11693.

Alignments / fixes needed

# Spec (#762) Current Nethermind Fix
1 error absent when no error occurred Always emits "error": nullGethTxTraceEntry.cs uses [JsonIgnore(Condition = JsonIgnoreCondition.Never)] Change to WhenWritingNull
2 storage emitted only at SLOAD/SSTORE, absent (not {}) otherwise Cumulative snapshot copied onto every opcode entry (GethLikeTxMemoryTracer.StartOperation) → emits "storage":{} on non-SLOAD/SSTORE ops Attach Storage only at SLOAD/SSTORE; omit when empty
3 memory words 0x-prefixed bytes32 No 0x prefix — TraceMemory.ToHexWordList() uses ToHexString() (default withZeroX:false) ToHexString(true) — need to check geth behaviour
4 storage keys/values 0x-prefixed bytes32 No 0x prefix — GethLikeTxMemoryTracer.SetOperationStorage uses ToHexString(false) ToHexString(true) — need to check geth behaviour

Already compliant (no change): stack encoding (0x-prefixed canonical uint256), top-level field names (gas/failed/returnValue/structLogs), integer gas/gasCost, op as opcode-name string, block-trace { txHash, result } pairing.

Scope

This issue covers the opcode-tracer wire-format alignment only. The error-path conformance cases that execution-apis#762 also ships are tracked/handled separately:

Suggested sequencing

  1. Solve 1-4.
  2. Port the conformance cases shipped in #762 (tests/debug_trace*) into the rpc-tests integration suite once the output aligns, including debug_traceBlockByHash coverage for the new txHash/result pairing.

Out of scope (tracked upstream, deferred from #762)

  • Memory-trace size optimization (enableMemory, memoryMode: none|full|onChange) — real issue (mainnet blocks producing hundreds of GiB of JSON) but a separate future PR.
  • gasCost accounting redesign for CALL (no client implements the "sum equals gas used" proposal).

Refs: ethereum/execution-apis#762, #11693

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions