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

Add 0x prefix to pushArg #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ardislu
Copy link

@ardislu ardislu commented Jul 10, 2023

pushArgs must have the 0x prefix, otherwise they will be incorrectly interpreted as decimal instead of hex.

For example, puzzle 9 is currently printed like this:

############
# Puzzle 9 #
############

00      36        CALLDATASIZE
01      6003      PUSH1 03
03      10        LT
04      6009      PUSH1 09
06      57        JUMPI
07      FD        REVERT
08      FD        REVERT
09      5B        JUMPDEST
0A      34        CALLVALUE
0B      36        CALLDATASIZE
0C      02        MUL
0D      6008      PUSH1 08
0F      14        EQ
10      6014      PUSH1 14
12      57        JUMPI
13      FD        REVERT
14      5B        JUMPDEST
15      00        STOP

The evm.codes playground will interpret PUSH1 14 as the bytecode 600e (0e is 14 in hex), and not 6014 as expected.

This PR will update pushArgs so it has the 0x prefix. So puzzle 9 will look like this:

############
# Puzzle 9 #
############

00      36        CALLDATASIZE
01      6003      PUSH1 0x03
03      10        LT
04      6009      PUSH1 0x09
06      57        JUMPI
07      FD        REVERT
08      FD        REVERT
09      5B        JUMPDEST
0A      34        CALLVALUE
0B      36        CALLDATASIZE
0C      02        MUL
0D      6008      PUSH1 0x08
0F      14        EQ
10      6014      PUSH1 0x14
12      57        JUMPI
13      FD        REVERT
14      5B        JUMPDEST
15      00        STOP

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.

1 participant