Skip to content

Commit 5bc2df7

Browse files
shemnonmarioevz
andauthored
new(tests): EIP-4200: EOF - Static relative jumps (#581)
* new(tests) EIP-4200 relative jumps 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]> * accidental commit Signed-off-by: Danno Ferrin <[email protected]> * fix(tests): EIP-4200: rebase fixes * fix(fw): Add missing TRUNCATED_INSTRUCTION EOF exception * new(tests): EOF: EIP-4200: more tests * fix(tests): tox fixes * docs: Changelog --------- Signed-off-by: Danno Ferrin <[email protected]> Co-authored-by: Mario Vega <[email protected]>
1 parent ddafeac commit 5bc2df7

File tree

8 files changed

+2580
-2
lines changed

8 files changed

+2580
-2
lines changed

docs/CHANGELOG.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ Test fixtures for use by clients are available for each release on the [Github r
1616
- ✨ Add tests for [EIP-6110: Supply validator deposits on chain](https://eips.ethereum.org/EIPS/eip-6110) ([#530](https://github.com/ethereum/execution-spec-tests/pull/530)).
1717
- ✨ Add tests for [EIP-7002: Execution layer triggerable withdrawals](https://eips.ethereum.org/EIPS/eip-7002) ([#530](https://github.com/ethereum/execution-spec-tests/pull/530)).
1818
- ✨ Add tests for [EIP-7685: General purpose execution layer requests](https://eips.ethereum.org/EIPS/eip-7685) ([#530](https://github.com/ethereum/execution-spec-tests/pull/530)).
19-
- ✨ Add tests for [EIP-2935: Serve historical block hashes from state
20-
](https://eips.ethereum.org/EIPS/eip-2935) ([#564](https://github.com/ethereum/execution-spec-tests/pull/564)).
19+
- ✨ Add tests for [EIP-2935: Serve historical block hashes from state](https://eips.ethereum.org/EIPS/eip-2935) ([#564](https://github.com/ethereum/execution-spec-tests/pull/564)).
20+
- ✨ Add tests for [EIP-4200: EOF - Static relative jumps](https://eips.ethereum.org/EIPS/eip-4200) ([#581](https://github.com/ethereum/execution-spec-tests/pull/581)).
2121

2222
### 🛠️ Framework
2323

src/ethereum_test_tools/exceptions/evmone_exceptions.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class EvmoneExceptionMapper:
6969
),
7070
ExceptionMessage(EOFException.INVALID_MAX_STACK_HEIGHT, "err: invalid_max_stack_height"),
7171
ExceptionMessage(EOFException.INVALID_DATALOADN_INDEX, "err: invalid_dataloadn_index"),
72+
ExceptionMessage(EOFException.TRUNCATED_INSTRUCTION, "err: truncated_instruction"),
7273
)
7374

7475
def __init__(self) -> None:

src/ethereum_test_tools/exceptions/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -680,6 +680,10 @@ class EOFException(ExceptionBase):
680680
"""
681681
A DATALOADN instruction has out-of-bounds index for the data section.
682682
"""
683+
TRUNCATED_INSTRUCTION = auto()
684+
"""
685+
EOF container's code section has truncated instruction.
686+
"""
683687

684688

685689
"""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""
2+
EOF tests for EIP-4200 relative jumps
3+
"""
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
EOF RJump tests helpers
3+
"""
4+
import itertools
5+
from enum import Enum
6+
7+
"""Storage addresses for common testing fields"""
8+
_slot = itertools.count()
9+
next(_slot) # don't use slot 0
10+
slot_code_worked = next(_slot)
11+
slot_conditional_result = next(_slot)
12+
slot_last_slot = next(_slot)
13+
14+
"""Storage values for common testing fields"""
15+
value_code_worked = 0x2015
16+
value_calldata_true = 10
17+
value_calldata_false = 11
18+
19+
20+
class JumpDirection(Enum):
21+
"""
22+
Enum for the direction of the jump
23+
"""
24+
25+
FORWARD = 1
26+
BACKWARD = -1

0 commit comments

Comments
 (0)