Skip to content

Commit daa8026

Browse files
committed
new(tests): EOF validation stack_range maximally broad
1 parent 6a9a515 commit daa8026

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

Diff for: converted-ethereum-tests.txt

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ EOFTests/efStack/jumpf_with_inputs_stack_overflow_variable_stack_.json
3838
EOFTests/efStack/non_constant_stack_height_.json
3939
EOFTests/efStack/retf_stack_validation_.json
4040
EOFTests/efStack/retf_variable_stack_.json
41+
EOFTests/efStack/stack_range_maximally_broad_.json
4142
EOFTests/efStack/forwards_rjump_.json
4243
EOFTests/efStack/forwards_rjump_variable_stack_.json
4344
EOFTests/efStack/forwards_rjumpi_.json

Diff for: tests/osaka/eip7692_eof_v1/eip5450_stack/test_code_validation.py

+16
Original file line numberDiff line numberDiff line change
@@ -626,3 +626,19 @@ def test_valid_non_constant_stack_examples(
626626
data=data,
627627
container_post=Account(storage=expected_storage),
628628
)
629+
630+
631+
@pytest.mark.parametrize("total_rjumpi", [1023, 1024])
632+
def test_stack_range_maximally_broad(eof_test, total_rjumpi: int):
633+
"""Test stack range 0-1023 at final instruction."""
634+
code = Op.STOP()
635+
for i in range(0, total_rjumpi):
636+
offset = i * 5 + 1
637+
code = Op.PUSH0 + Op.RJUMPI[offset] + Op.PUSH0 + code
638+
639+
container = Container(sections=[Section.Code(code=code, max_stack_height=1023)])
640+
641+
eof_test(
642+
container=container,
643+
expect_exception=None if total_rjumpi <= 1023 else EOFException.INVALID_MAX_STACK_INCREASE,
644+
)

Diff for: tests/osaka/eip7692_eof_v1/eof_tracker.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@
321321
- [ ] Wrong max_stack_height (ethereum/tests: ./src/EOFTestsFiller/efExample/validInvalidFiller.yml src/EOFTestsFiller/efValidation/max_stack_height_Copier.json)
322322
- [ ] All opcodes correctly account for stack inputs/outputs (ethereum/tests: src/EOFTestsFiller/EIP5450/validInvalidFiller.yml)
323323
- [ ] Code reachable only via backwards jump is invalid
324-
- [ ] Maximally broad [0, 1023] stack range (ethereum/tests: src/EOFTestsFiller/efStack/stack_range_maximally_broad_Copier.json)
324+
- [x] Maximally broad [0, 1023] stack range ([tests/osaka/eip7692_eof_v1/eip_5450_stack/test_code_validation.py::test_stack_range_maximally_broad](tests/osaka/eip7692_eof_v1/eip_5450_stack/test_code_validation/test_stack_range_maximally_broad.md))
325325

326326
### Execution
327327

0 commit comments

Comments
 (0)