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

tools: Fixes, Improvements to Opcodes/Code/Types #196

Merged
merged 9 commits into from
Jul 14, 2023

Conversation

marioevz
Copy link
Member

@marioevz marioevz commented Jul 6, 2023

Changes Included

  • Add len to the Code class
  • Allow Opcode's data portion or stack elements to be hex strings
  • Adds a counter to the storage type, which allows to automatically store a value to the next slot in an internal counter, and return the slot number.

Storage counter

Tests can now use the following pattern:

bytecode = Op.SSTORE(storage.store_next(expected_value), Op.CALLDATALOAD(0))
bytecode += Op.SSTORE(storage.store_next(expected_value_2), Op.CALLDATALOAD(1))

And storage will keep track of the next storage slot to use, keeping code clean, and preventing overwriting a verification value in a loop for example.

@marioevz marioevz changed the title tools: Fixes, Improvements to Opcodes/Code tools: Fixes, Improvements to Opcodes/Code/Types Jul 9, 2023
Copy link
Collaborator

@spencer-tb spencer-tb left a comment

Choose a reason for hiding this comment

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

LGTM! :D

@marioevz marioevz merged commit bc1fb17 into ethereum:main Jul 14, 2023
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants