Conversation
Closes #89. EEVM.Tracer records one TraceStep per opcode with pre-step PC, stack, memory size, gas, depth, and refund. Output renders as EIP-3155 / geth --json lines for diffing against reference runs. Steps are captured before each opcode so CALL appears before the child's opcodes in the trace, and the tracer is threaded through CALL/CREATE frame boundaries to keep depth correct. The tracer is nil by default; when unset, the executor's trace hooks are pattern-matched away with no snapshot work. Opt in via EEVM.trace/2 or pass tracer: EEVM.Tracer.new() to MachineState.new/2. gas_cost is recorded as the static cost known pre-execution; dynamic portions (CALL/SSTORE/EXP etc.) are a known limitation of this first cut. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
EEVM.Tracer— collects oneTraceStepper opcode with PC, stack, memory size, gas, depth, refund; steps captured pre-execution so CALL appears before the child's opcodes in chronological orderEEVM.trace/2entry point (returns{state, tracer});EEVM.Tracer.to_json/1renders EIP-3155 / geth--jsonlines for diffing against reference implementationsCloses #89.
Design notes
tracer: niland return the state unchanged — no snapshot work on the hot path.gas_costis recorded as the static cost known pre-execution. Dynamic portions for CALL, SSTORE, EXP, SHA3, etc. are a known limitation of this first cut; ordering and all other fields are accurate.Test plan
mix test— 547 tests, 0 failures (12 new)mix format --check-formattedmix credo --strict— no issuesmix compile --warnings-as-errorsTrace tests cover: opt-in default (nil), per-step pc/gas/stack/depth/op, out-of-gas and stack-underflow error capture, nested call depth, JSON shape and error field.
🤖 Generated with Claude Code