Opt-in opcode-level execution tracer.
A tracer is attached to a MachineState (via MachineState.new/2 with
tracer: EEVM.Tracer.new()). When present, the executor records one
TraceStep per opcode with pre-execution PC, stack, memory size, and
depth plus the actual gas cost charged by that step.
Output is compatible with the evm --json format defined by EIP-3155,
so traces can be diffed against geth/revm reference runs.
Performance
When the tracer field is nil (default), the executor skips all trace
bookkeeping — no snapshot is taken and the tracer branch is a single
pattern-match-and-return. Trace capture is opt-in at the call site.
Summary
Functions
Returns the opcode name atom for a byte (e.g. 0x01 -> :ADD).
Marks the most recently recorded step with an error reason.
Returns the recorded steps in execution order.
Renders the trace as a single newline-joined JSON string.
Renders the trace as EIP-3155 / geth --json compatible JSON lines.
Types
@type snapshot() :: %{ pc: non_neg_integer(), op_byte: non_neg_integer(), op: atom(), gas: non_neg_integer(), stack: [non_neg_integer()], memory_size: non_neg_integer(), depth: non_neg_integer(), refund: non_neg_integer() }
@type t() :: %EEVM.Tracer{steps: [EEVM.Tracer.TraceStep.t()]}
Functions
@spec new() :: t()
@spec op_name(non_neg_integer()) :: atom()
Returns the opcode name atom for a byte (e.g. 0x01 -> :ADD).
@spec record(t(), EEVM.Tracer.TraceStep.t()) :: t()
Marks the most recently recorded step with an error reason.
@spec steps(t()) :: [EEVM.Tracer.TraceStep.t()]
Returns the recorded steps in execution order.
Renders the trace as a single newline-joined JSON string.
Renders the trace as EIP-3155 / geth --json compatible JSON lines.
Returns a list of JSON-encoded strings, one per step. Join with newlines for geth-style output.