Skip to content

Commit

Permalink
new(tests): EIP-4200: EOF - Static relative jumps (#581)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
shemnon and marioevz authored Jun 4, 2024
1 parent ddafeac commit 5bc2df7
Show file tree
Hide file tree
Showing 8 changed files with 2,580 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ Test fixtures for use by clients are available for each release on the [Github r
- ✨ 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)).
- ✨ 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)).
- ✨ 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)).
- ✨ 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)).
- ✨ 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)).
- ✨ 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)).

### 🛠️ Framework

Expand Down
1 change: 1 addition & 0 deletions src/ethereum_test_tools/exceptions/evmone_exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ class EvmoneExceptionMapper:
),
ExceptionMessage(EOFException.INVALID_MAX_STACK_HEIGHT, "err: invalid_max_stack_height"),
ExceptionMessage(EOFException.INVALID_DATALOADN_INDEX, "err: invalid_dataloadn_index"),
ExceptionMessage(EOFException.TRUNCATED_INSTRUCTION, "err: truncated_instruction"),
)

def __init__(self) -> None:
Expand Down
4 changes: 4 additions & 0 deletions src/ethereum_test_tools/exceptions/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -680,6 +680,10 @@ class EOFException(ExceptionBase):
"""
A DATALOADN instruction has out-of-bounds index for the data section.
"""
TRUNCATED_INSTRUCTION = auto()
"""
EOF container's code section has truncated instruction.
"""


"""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
"""
EOF tests for EIP-4200 relative jumps
"""
26 changes: 26 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,26 @@
"""
EOF RJump tests helpers
"""
import itertools
from enum import Enum

"""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


class JumpDirection(Enum):
"""
Enum for the direction of the jump
"""

FORWARD = 1
BACKWARD = -1
Loading

0 comments on commit 5bc2df7

Please sign in to comment.