Skip to content

Commit

Permalink
new(tests) EIP-4200 relative jumps
Browse files Browse the repository at this point in the history
Port over ethereum/tests EIP-4200 tests, both validation and execution.
Some duplicate tests were dropped, and some new immediate tests were
added.

Signed-off-by: Danno Ferrin <[email protected]>
  • Loading branch information
shemnon committed May 31, 2024
1 parent a4b68e8 commit 5716d2b
Show file tree
Hide file tree
Showing 7 changed files with 2,056 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/ethereum_test_tools/vm/opcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -5511,28 +5511,26 @@ class Opcodes(Opcode, Enum):
Source: [EIP-7069](https://eips.ethereum.org/EIPS/eip-7069)
"""

CREATE4 = Opcode(0xF7, popped_stack_items=5, pushed_stack_items=1)
RETURNDATALOAD = Opcode(0xF7, popped_stack_items=1)
"""
!!! Note: This opcode is under development
CREATE4()
RETURNDATALOAD(offset)
----
Description
----
Copy 32 bytes from returndata at offset onto the stack
Inputs
----
Outputs
----
- offset: byte offset in the return data from the last executed sub context to copy
Fork
----
EOF
Gas
----
3
"""

REVERT = Opcode(0xFD, popped_stack_items=2)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
EOF tests for EIP-4200 relative jumps
"""
16 changes: 16 additions & 0 deletions tests/prague/eip7692_eof_v1/eip4200_relative_jumps/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
EOF RJump tests helpers
"""
import itertools

"""Storage addresses for common testing fields"""
_slot = itertools.count()
next(_slot) # don't use slot 0
slot_code_worked = next(_slot)
slot_conditional_result = next(_slot)
slot_last_slot = next(_slot)

"""Storage values for common testing fields"""
value_code_worked = 0x2015
value_calldata_true = 10
value_calldata_false = 11
5 changes: 5 additions & 0 deletions tests/prague/eip7692_eof_v1/eip4200_relative_jumps/spec.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
"""
EOF V1 Constants used throughout all tests
"""

EOF_FORK_NAME = "Prague"
Loading

0 comments on commit 5716d2b

Please sign in to comment.