Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(fw): Parameter count check on opcode calls #492

Merged
merged 5 commits into from
Apr 9, 2024

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Apr 1, 2024

🗒️ Description

Adds a simple check that the number of parameters used to call an opcode (to generate bytecode) is the same as the popped stack items for the given opcode.

E.g.

Op.CREATE(1, 2, 3, 4, 5, 6, 7)

Now results in: "ValueError: Opcode CREATE requires 3 stack elements, but 7 were provided. Use 'unchecked=True' parameter to ignore this check.".

This works:

Op.CREATE(1, 2, 3, 4, 5, 6, 7, unchecked=True)

The check is superficial as it does not verify that the bytecode specified on each parameter indeed pushes 1 item to the stack.

@winsvega

🔗 Related Issues

#441

✅ Checklist

  • All: Set appropriate labels for the changes.
  • All: Considered squashing commits to improve commit history.
  • All: Added an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • Tests: All converted JSON/YML tests from ethereum/tests have been added to converted-ethereum-tests.txt.
  • Tests: Included the type and version of evm t8n tool used to locally execute test cases: e.g., ref with commit hash or geth 1.13.1-stable-3f40e65.
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.

@marioevz marioevz added scope:tests Scope: Test cases type:feat type: Feature scope:fw Scope: Framework (evm|tools|forks|pytest) labels Apr 1, 2024
@marioevz marioevz requested a review from winsvega April 1, 2024 23:38
Copy link
Member

@danceratopz danceratopz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really nice! Should help catch some obvious problems more quickly.

@marioevz marioevz merged commit cb53427 into ethereum:main Apr 9, 2024
5 checks passed
@marioevz marioevz deleted the opcode-parameter-count branch April 9, 2024 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:fw Scope: Framework (evm|tools|forks|pytest) scope:tests Scope: Test cases type:feat type: Feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants