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

fix: opcodes and opcodes_runtime outputs #3735

Merged
merged 2 commits into from
Jan 18, 2024

Conversation

trocher
Copy link
Contributor

@trocher trocher commented Jan 18, 2024

What I did

Fixed the opcodes and opcodes_runtime outputs as they would not respectively match the bytecode and bytecode_runtime outputs.

The value following a PUSH instruction could be incorrect. For example, when compiling some Vyper code that results in PUSH2 0x100:

  • The bytecode output would be 610100
  • The opcodes output would be PUSH2 0x10 instead of PUSH2 0x100

This issue is due to a lack of 0 padding.

How I did it

In build_opcodes, left pad each byte to be concatenated with 0 to have a length of 2 digits

How to verify it

Check the tests

Commit message

Fixed the opcodes and opcodes_runtime outputs as they would not
respectively match the bytecode and bytecode_runtime outputs.

The value following a PUSH instruction could be incorrect. For example,
when compiling some Vyper code that results in `PUSH2 0x0100`:

- The bytecode output would be `610100`
- The opcodes output would be `PUSH2 0x10` instead of `PUSH2 0x0100`

Note this commit fixes an ambiguity here, as prior to this commit,
`610100` (`PUSH2 0x0100`) and `610010` (`PUSH2 0x0010`) would both get
formatted as `PUSH2 0x10`.

This issue is due to a lack of 0 padding.

Description for the changelog

fix: opcode and opcodes_runtime outputs

Cute Animal Picture

Put a link to a cute animal picture inside the parenthesis-->

@trocher trocher marked this pull request as draft January 18, 2024 09:22
@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (81c6d8e) 84.18% compared to head (5744d71) 84.78%.
Report is 2 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3735      +/-   ##
==========================================
+ Coverage   84.18%   84.78%   +0.60%     
==========================================
  Files          92       92              
  Lines       13143    13137       -6     
  Branches     2928     2929       +1     
==========================================
+ Hits        11064    11138      +74     
+ Misses       1659     1535     -124     
- Partials      420      464      +44     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pcaversaccio
Copy link
Collaborator

@charles-cooper we should definitely document this behaviour in the docs. To make everyone's life easier, I already opened a separate PR: #3736.

@trocher trocher marked this pull request as ready for review January 18, 2024 10:41
@charles-cooper charles-cooper changed the title fix: opcodes and opcodes_runtime outputs fix: opcodes and opcodes_runtime formatting Jan 18, 2024
@charles-cooper charles-cooper changed the title fix: opcodes and opcodes_runtime formatting fix: opcodes and opcodes_runtime outputs Jan 18, 2024
@charles-cooper charles-cooper merged commit 56b0d4f into vyperlang:master Jan 18, 2024
84 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.

4 participants