evm: add pushData to step trace for PUSH0–PUSH32#4283
Open
alirazzaq-dev wants to merge 1 commit into
Open
Conversation
Expose optional InterpreterStep.pushData so tracers can read the bytes placed on the stack without re-parsing bytecode. PUSH0 sets a single 0x00 byte; PUSH1–PUSH32 reuse the existing immediate slice. Closes ethereumjs#2418. Co-authored-by: Cursor <cursoragent@cursor.com>
Member
|
@alirazzaq-dev Hi hi, thanks for the contribution and sorry that this went on the side line a bit. Are you still interested in bringing this over the finish line? |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Member
|
(P.S. you can ignore the upper two failures (bundle + vm dev tests)) |
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
Implements Issue #2418: when tracing via the EVM
stepevent, expose the bytes thatPUSH0–PUSH32place on the stack in an optionalInterpreterStepfield so callers do not have to re-slice bytecode.PUSH0has noimmediatein the existingstackDeltapath; this change setspushDatato a single0x00byte for that opcode. ForPUSH1–PUSH32,pushDatamatches the existingimmediateslice (intentional overlap for clarity). Non-PUSH opcodes (including EOFRJUMPimmediates, which useimmediatebut are outside0x5f–0x7f) leavepushDataunset.Changes
evm:InterpreterStep.pushData?: Uint8Arrayand populate it in_runStepHookwhen the opcode byte is0x5f–0x7f(PUSH0:new Uint8Array([0]);PUSH1–PUSH32: same slice asimmediate).stepevent JSDoc, inREADME.md(Events), and inCHANGELOG.mdunder## Unreleased.test/stepPushData.spec.ts(PUSH0, PUSH1, PUSH32 length, non-PUSH has nopushData).Testing
cd packages/evm && npx vitest run— all EVM package tests pass.npx @biomejs/biome check src/interpreter.ts test/stepPushData.spec.ts— clean.npx tsc --noEmit -p tsconfig.json(inpackages/evm) — clean.Closes #2418.