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: implement 0x52 - MSTORE Opcode #290

Merged
merged 13 commits into from
Sep 8, 2023
Merged

Conversation

Quentash
Copy link
Contributor

@Quentash Quentash commented Sep 6, 2023

Pull Request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Build-related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

Resolves: #243 and #289

What is the new behavior?

Does this introduce a breaking change?

  • Yes
  • No

Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

It would be nice to add a tests that loads the entire memory and verifies the state of it.

For example when you do

    ctx.stack.push(0xFF00);
    ctx.stack.push(0x01);

Then verifying that the memory is 64 bytes long, that the first word is 0xff and the second word is 0.

You should also add two cases where we have:

  • no offset
  • 32-bytes offset

@Quentash
Copy link
Contributor Author

Quentash commented Sep 7, 2023

Corrected "succeed" into "succeeded".
Used pop_n(2) instea of 2 pop().
Added a test case with offset 0.
Added a test case with offset 32.
Added memory length verification into tests.
Used integer::BoundedInt for max value.

Copy link
Member

@ClementWalter ClementWalter left a comment

Choose a reason for hiding this comment

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

thx, there are too much test for this! in terms of unit testing, when writing tests for exec_{} we mainly need to test that we popped enough arguments, and that we pass them correctly to the underlying function implementing the logic (if the logic is in another funcion, as it is the case here).

@Quentash
Copy link
Contributor Author

Quentash commented Sep 7, 2023

Removed many unnecessary tests.
Reverted back to single pop.
Replaced "only_Fs" by "max_uint256".
Added to self to-do list to read more about english past participle.

Copy link
Collaborator

@enitrat enitrat left a comment

Choose a reason for hiding this comment

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

lgtm

@Eikix Eikix merged commit 5558fbd into kkrt-labs:main Sep 8, 2023
1 of 2 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.

feat: implement 0x52 - MSTORE Opcode
4 participants