Skip to content

Commit 4eea3bb

Browse files
chfastpdobacz
andauthored
new(tests): test for CALLF to non-returning section (ethereum#1126)
This adds tests for previously uncovered EOF validation error of CALLF to nonreturning sections. Co-authored-by: pdobacz <[email protected]>
1 parent 83d5917 commit 4eea3bb

File tree

2 files changed

+69
-1
lines changed

2 files changed

+69
-1
lines changed

osaka/eip7692_eof_v1/eip6206_jumpf/test_nonreturning_validation.py

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,71 @@ def test_jumpf_in_nonreturning(eof_test: EOFTestFiller, first: bool, code_prefix
138138
validity_error=EOFException.INVALID_NON_RETURNING_FLAG,
139139
)
140140
)
141+
142+
143+
@pytest.mark.parametrize(
144+
"container",
145+
[
146+
Container(
147+
name="0_to_1",
148+
sections=[
149+
Section.Code(
150+
Op.CALLF[1],
151+
),
152+
Section.Code(
153+
Op.STOP,
154+
),
155+
],
156+
),
157+
Container(
158+
name="self_0",
159+
sections=[
160+
Section.Code(
161+
Op.CALLF[0] + Op.STOP,
162+
)
163+
],
164+
),
165+
Container(
166+
name="self_1",
167+
sections=[
168+
Section.Code(
169+
Op.JUMPF[1],
170+
),
171+
Section.Code(
172+
Op.CALLF[1] + Op.STOP,
173+
),
174+
],
175+
),
176+
Container(
177+
name="1_to_0",
178+
sections=[
179+
Section.Code(
180+
Op.CALLF[1] + Op.STOP,
181+
),
182+
Section.Code(
183+
Op.CALLF[0] + Op.RETF,
184+
code_outputs=0,
185+
),
186+
],
187+
),
188+
Container(
189+
name="1_to_2",
190+
sections=[
191+
Section.Code(
192+
Op.CALLF[1] + Op.STOP,
193+
),
194+
Section.Code(
195+
Op.CALLF[2] + Op.RETF,
196+
code_outputs=0,
197+
),
198+
Section.Code(
199+
Op.INVALID,
200+
),
201+
],
202+
),
203+
],
204+
ids=lambda x: x.name,
205+
)
206+
def test_callf_to_nonreturning(eof_test: EOFTestFiller, container: Container):
207+
"""Test EOF validation failing due to CALLF to non-returning section."""
208+
eof_test(data=container, expect_exception=EOFException.CALLF_TO_NON_RETURNING)

osaka/eip7692_eof_v1/eof_tracker.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@
334334

335335
- [x] Zero section returning ([`tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_nonreturning_validation.py::test_first_section_returning`](./eip6206_jumpf/test_nonreturning_validation/test_first_section_returning.md), ethereum/tests: ./src/EOFTestsFiller/efExample/validInvalidFiller.yml src/EOFTestsFiller/EIP4750/validInvalidFiller.yml)
336336
- [x] Zero section declared non-returning but ends with RETF ([`tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_nonreturning_validation.py::test_retf_in_nonreturning`](./eip6206_jumpf/test_nonreturning_validation/test_retf_in_nonreturning.md), ethereum/tests: src/EOFTestsFiller/EIP4750/validInvalidFiller.yml)
337-
- [ ] CALLF into non-returning function (ethereum/tests: src/EOFTestsFiller/efValidation/callf_into_nonreturning_Copier.json)
337+
- [x] CALLF into non-returning function ([`tests/osaka/eip7692_eof_v1/eip6206_jumpf/test_nonreturning_validation.py::test_callf_to_nonreturning`](./eip6206_jumpf/test_nonreturning_validation/test_callf_to_nonreturning.md))
338338
- [ ] Valid JUMPF into sections with equal number of outputs (ethereum/tests: src/EOFTestsFiller/efValidation/jumpf_equal_outputs_Copier.json)
339339
- [ ] Valid JUMPF into sections with different but compatible number of outputs (ethereum/tests: src/EOFTestsFiller/efValidation/jumpf_compatible_outputs_Copier.json)
340340
- [ ] JUMPF into sections with incompatible outputs (ethereum/tests: src/EOFTestsFiller/efValidation/jumpf_incompatible_outputs_Copier.json)

0 commit comments

Comments
 (0)