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

[WIP] Implementation of EOF static relative jumps and functions #1

Draft
wants to merge 82 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
82 commits
Select commit Hold shift + click to select a range
24bb63a
add RJUMP and RJUMPI instructions and create a new EVM version to rep…
harkal Dec 20, 2022
ce4b8ba
get_opcode() utility function to get the opcode for a mnemonic
harkal Dec 20, 2022
6105ac6
implement RJUMP
harkal Dec 20, 2022
646c5be
properly output RJUMP enabled opcode formating
harkal Dec 20, 2022
708e2ae
refactor symbol to be before RJUMP for consistency
harkal Dec 20, 2022
f107f98
if supported emmit RJUMPI
harkal Dec 20, 2022
a825150
fix pc progression for RJUMP RJUMPI
harkal Dec 20, 2022
0ee6d69
emit RJUMP for if and repeat
harkal Dec 20, 2022
7e60551
assert for very lange offsets
harkal Dec 20, 2022
1bae653
enable RJUMP ineffiecient optimization
harkal Dec 20, 2022
54a2da0
update evm version and proper checking
harkal Dec 20, 2022
9d13915
add CALLF, RETF, JUMPF definitions
harkal Dec 20, 2022
a42ef86
fix tests
harkal Dec 20, 2022
ca268d2
rename EOF evm version to shanghai
harkal Dec 20, 2022
4c66254
add RJUMPV
harkal Dec 20, 2022
d4febb0
add output for new opcodes
harkal Dec 21, 2022
67b2c03
add CALLF emission and JUMPF CALLF handling
harkal Dec 21, 2022
66202cc
add validate_eof.py cli util
harkal Dec 24, 2022
9c39727
update EOFv1 validation script
harkal Dec 24, 2022
bb37644
track proper size
harkal Dec 24, 2022
fa5df33
validate code
harkal Dec 24, 2022
bbaa63e
EOFv1 enabled emits retf
harkal Dec 28, 2022
c703e20
refactor EOF_ENABLED to EOFv1_ENABLED
harkal Dec 28, 2022
190261d
generate callf
harkal Dec 28, 2022
e4ec072
disable return rewrites and only handle gotos that are not simple jumps
harkal Dec 28, 2022
3314262
skip JUMPDESTs when EOFv1
harkal Dec 28, 2022
930b8ca
exit_to wip
harkal Dec 28, 2022
7af3215
goto wip
harkal Dec 28, 2022
540c764
fix ident
harkal Dec 29, 2022
4911ab9
eofv1 header output wip
harkal Dec 29, 2022
78d4c87
file should be handled higher
harkal Dec 29, 2022
8ad038d
eof handling code
harkal Dec 29, 2022
40641a8
function to get opcode's immediate size
harkal Dec 29, 2022
282af9d
eof reader class
harkal Dec 29, 2022
18c17c4
fix naming
harkal Dec 29, 2022
c2cfe42
validator
harkal Dec 29, 2022
bc86be0
create reverse mapping from opcode to mnemonic
harkal Jan 2, 2023
2b8bea9
read code sections and validate wip
harkal Jan 2, 2023
f335a7c
use class members
harkal Jan 2, 2023
742b19e
update cli verification tool to use vyper
harkal Jan 2, 2023
8114b8a
remove size
harkal Jan 2, 2023
caca9b3
use eof constants
harkal Jan 2, 2023
6ec3d51
remove double size
harkal Jan 2, 2023
e50a8d5
remove JUMPF and PC for eof
harkal Jan 2, 2023
949ea14
convert callf offsets to function ids
harkal Jan 3, 2023
9a4da0a
compute and emit code section sizes
harkal Jan 3, 2023
951d8cc
update type section
harkal Jan 3, 2023
aa0f24b
disable code validation for now
harkal Jan 3, 2023
92964fb
emit types
harkal Jan 3, 2023
e04ac07
wip
harkal Jan 4, 2023
8e293f0
remove decorateEOFHeader
harkal Jan 4, 2023
69e10da
append headers at bytecode start for deploy and runtime
harkal Jan 4, 2023
0fd53d1
proper size for deploy code
harkal Jan 4, 2023
9abb708
handle consecutive eofv1 containers
harkal Jan 4, 2023
d3ce4a6
eofv1 disassemble debuging support
harkal Jan 4, 2023
282a88f
temp
harkal Jan 4, 2023
3feaba2
print separators
harkal Jan 4, 2023
09e7237
remove unused return value
harkal Jan 4, 2023
75660a9
output update
harkal Jan 4, 2023
f5c34c1
fix return opcodes
harkal Jan 4, 2023
8f133dd
convert revert jump to function call
harkal Jan 5, 2023
1af9d01
enable code validation
harkal Jan 5, 2023
fb431f6
add ending new lines
harkal Jan 5, 2023
b0050fd
runnable
harkal Jan 9, 2023
e9b11c7
properly order functions breaks
harkal Jan 9, 2023
af1f1f6
fix revert call
harkal Jan 9, 2023
1817f42
remove return pc from stack
harkal Jan 9, 2023
fb2d62d
pop arg buffer address on retf
harkal Jan 10, 2023
2f77eac
outout 1 input for all functions exept main
harkal Jan 10, 2023
4332d3f
refactoring, add eof enable parameter, proper output
harkal Jan 10, 2023
1c30bc5
default to paris
harkal Jan 10, 2023
e46ce90
add in old parameter for tests
harkal Jan 10, 2023
61202e3
fix legacy case
harkal Jan 10, 2023
b08330b
update readme
harkal Jan 10, 2023
511df2b
more detail in the exception
harkal Jan 11, 2023
51ce2d8
assert push size gt 0
harkal Jan 11, 2023
5ee0a46
update shanghai to cancun
harkal Jan 12, 2023
63ccde9
shanghai -> cancun
harkal Jan 12, 2023
e7f0671
get opcode metadata helper
harkal Jan 18, 2023
ee1a62a
calculate_max_stack_height() implementation
harkal Jan 18, 2023
a96f172
append proper max stack heights to eof header
harkal Jan 18, 2023
6935351
leftout import
harkal Jan 18, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ python setup.py test

This version of the Vyper compiler supports the upcoming EOFv1 bytecode format. This is currently under
development and in alpha state. To enable the experimental EOFv1 support you use the
``--experimental-eof`` command line option. Additionally a greater than ``paris`` evm version should
``--experimental-eof`` command line option. Additionally a greater or equal to ``cancun`` evm version should
be used.

Usage example:
Expand Down
2 changes: 1 addition & 1 deletion tests/compiler/test_opcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_version_check(evm_version):

def test_get_opcodes(evm_version):
op = opcodes.get_opcodes()
if evm_version in ("shanghai", "paris", "berlin"):
if evm_version in ("cancun", "shanghai", "paris", "berlin"):
assert "CHAINID" in op
assert op["SLOAD"][-1] == 2100
elif evm_version == "istanbul":
Expand Down
1 change: 1 addition & 0 deletions vyper/evm/opcodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"berlin": 3,
"paris": 4,
"shanghai": 5,

Choose a reason for hiding this comment

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

shanghai is not needed anymore I think, as we are introducing it in this PR.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is the proper way to handle this here? Should I skip shanghai completely? I was worried it might cause problems somewhere else. For example the --evm-version parameter will not accept it anymore (not that it changes anything). If other forks are missing I guess it's totally ok to remove it.

Choose a reason for hiding this comment

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

@charles-cooper I think mentioned it's fine if we don't have all forks defined here.

"cancun": 6,

# ETC Forks
"atlantis": 0,
Expand Down