EIP-7756 EVM trace spec with EOF support (EOF/EVM Trace Specification)

No call decision · EVM & execution · EIP status Stagnant · created 2024-08-13

Adds EOF (EVM Object Format) support to the EVM execution trace standard from EIP-3155, making it possible to trace EOF container code together with existing legacy code within a single trace.

Why it is needed

EIP-3155 is a trace standard that records EVM operations line by line as JSON, and has long been used for debugging and testing. However, with the introduction of EOF (EIP-7692), contracts are now split into multiple sections and have function-call structures such as CALLF and RETF, and the existing trace fields had no way to express which section is currently executing or how deep the function call nesting is. In addition, as trace usage expanded beyond state testing to real-time block tracing and differential fuzzing comparing execution results across clients, the need grew to bring the standard up to date.

What changes

Today

After EIP-7756

Who is affected

In depth

Required fields

Every trace line MUST include pc, op, opName, gas, stack, depth, and error. pc is counted from 0 starting at the beginning of the contract (or EOF container); for EOF contracts, since the 0xEF magic byte is position 0, actual execution does not start at pc 0 but at the first byte of the first code section. If the stack is empty, use an empty array instead of null, and depth starts at 1.

Recommended fields

gasCost, memSize, returnData, and refund are recommended to be present. gasCost is the sum including memory expansion, call stipend, and account warming costs, and memSize is counted in 8-bit bytes rather than 256-bit words. returnData is omitted if a CALL-type operation within the current frame has not yet completed.

EOF-only optional fields

section is the current executing section number, included only when tracing a contract inside an EOF container. immediate is the raw byte value that MUST be attached to any operation with an immediate value, except PUSH-type operations. functionDepth is the depth of the EIP-4750 CALLF call stack, starting at 1; it can be omitted when the value is 1, and is not included for code that is not inside an EOF container. If a particular field is omitted within a trace, it MUST be omitted consistently throughout the entire trace.

Summary line

Once execution finishes, the client is recommended to output a single JSON object summary containing stateRoot, output, gasUsed, pass, time, and fork. time and fork may optionally be provided.

Numeric types and compatibility

Values such as gas, gasCost, and pc can be represented as either Number or Hex-Number, and clients may optionally output either, but it is recommended to provide a CLI option that strictly outputs only one of the two. Numbers larger than 2^53-1 MUST be represented as Hex-Number due to JSON's limitations.

Changes from EIP-3155

Compared to the original EIP-3155, gas, gasCost, and gasUsed have changed to the Number type, and opcode has changed to the Hex-Number type. Aside from this type change, clients tracing legacy contracts can produce traces backward-compatible with the original.

Security considerations

Tracing consumes significant CPU and network bandwidth. The tracing endpoint should not be enabled by default, and when enabled, access MUST be restricted at the network level; otherwise, a flood of requests could prevent validator clients from issuing attestations in time. Differential fuzzing is useful for finding consensus discrepancies between clients, but it is only effective if client teams fix discovered issues promptly.

Current status

This EIP's status is Stagnant, meaning it is not being actively discussed and has stalled. It is premised on EIP-3155 and EIP-4750, and the provided call records contain no fork-inclusion decision related to this proposal.

Original EIP · ← EIPs