Skip to content

Commit e317fd0

Browse files
authored
Merge pull request #907 from ipsilon/fix-eof-tests
bug(tests) - CALLF rule #4 applies to return stack, not operand stack
2 parents 5a31516 + bec7466 commit e317fd0

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

tests/osaka/eip7692_eof_v1/eip3540_eof_v1/test_migrated_valid_invalid.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@
104104
pytest.param(
105105
# Trailing bytes after code section with wrong first section type
106106
bytes.fromhex("ef0001 010004 0200010001 040000 00 00000000 fe aabbcc"),
107-
EOFException.INVALID_FIRST_SECTION_TYPE,
107+
[EOFException.INVALID_FIRST_SECTION_TYPE, EOFException.INVALID_SECTION_BODIES_SIZE],
108108
id="EOF1I3540_0027_trailing_bytes_after_code_section_with_wrong_first_section_type",
109109
),
110110
pytest.param(
@@ -159,7 +159,7 @@
159159
pytest.param(
160160
# Trailing bytes after data section with wrong first section type
161161
bytes.fromhex("ef0001 010004 0200010001 040002 00 00000000 fe aabbccdd"),
162-
EOFException.INVALID_FIRST_SECTION_TYPE,
162+
[EOFException.INVALID_FIRST_SECTION_TYPE, EOFException.INVALID_SECTION_BODIES_SIZE],
163163
id="EOF1I3540_0035_trailing_bytes_after_data_section_with_wrong_first_section_type",
164164
),
165165
pytest.param(

tests/osaka/eip7692_eof_v1/eip4750_functions/test_callf_execution.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,8 @@ def test_callf_sneaky_stack_overflow(
360360
("stack_height", "failure"),
361361
(
362362
pytest.param(1018, False, id="no_max_stack"),
363-
pytest.param(1019, True, id="with_max_stack"),
363+
pytest.param(1019, False, id="with_max_stack"),
364+
pytest.param(1020, True, id="over_max_stack"),
364365
),
365366
)
366367
def test_callf_max_stack(
@@ -374,11 +375,13 @@ def test_callf_max_stack(
374375
375376
Code Section 0 - calls #1 with the configured height, but we load some operands so the
376377
return stack does not overflow
377-
Code Section 1 - recursively calls itself until input is zero, then calls 2 and returns.
378+
Code Section 1 - expands stack, calls #2, THEN recursively calls itself until input is zero,
379+
and returns.
378380
Code Section 2 - Just returns, zero inputs, zero outputs
379381
380-
This will catch CALLF rule #4: always fail if the operand stack is full. Not checking
381-
rule 4 results in a call to section 2 and not overfilling the stack (as it is just RETF).
382+
This will catch CALLF execution rule #3: always fail if the operand stack is full. Not
383+
checking rule 3 results in a call to section 2 and not overfilling the stack (as it is just
384+
RETF).
382385
"""
383386
env = Environment()
384387
sender = pre.fund_eoa()

0 commit comments

Comments
 (0)