Skip to content

Commit

Permalink
new(tests): EOF - EIP-4200: migrate remaining RJUMP* execution tests (e…
Browse files Browse the repository at this point in the history
…thereum#916)

The RJUMP/RJUMPI/RJUMPV execution tests were actually migrated
by @shemnon in ethereum#581

This adds just one more basic RJUMPI/RJUMP test.
  • Loading branch information
chfast authored Oct 25, 2024
1 parent 0ed27a0 commit 2939e0a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions converted-ethereum-tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ EOFTests/efValidation/EOF1_returncontract_invalid_.json
EOFTests/efValidation/EOF1_returncontract_valid_.json

EIPTests/StateTests/stEOF/stEIP3540/EOF1_Execution.json
EIPTests/StateTests/stEOF/stEIP4200/EOF1_RJUMP_RJUMPI_RJUMPV_Execution.json

([#440](https://github.com/ethereum/execution-spec-tests/pull/440))
GeneralStateTests/Cancun/stEIP1153-transientStorage/01_tloadBeginningTxn.json
Expand Down
17 changes: 17 additions & 0 deletions tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjump.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,23 @@
RJUMP_LEN = len(Op.RJUMP[0])


def test_rjump_negative(
eof_state_test: EOFStateTestFiller,
):
"""Test for a forward RJUMPI and backward RJUMP"""
eof_state_test(
data=Container.Code(
Op.PUSH1[1]
+ Op.RJUMPI[7] # RJUMP cannot be used because of the backward jump restriction
+ Op.SSTORE(slot_code_worked, Op.MLOAD(0))
+ Op.STOP
+ Op.MSTORE(0, value_code_worked)
+ Op.RJUMP[-16]
),
container_post=Account(storage={slot_code_worked: value_code_worked}),
)


def test_rjump_positive_negative(
eof_state_test: EOFStateTestFiller,
):
Expand Down

0 comments on commit 2939e0a

Please sign in to comment.