Skip to content

Commit f10dc9d

Browse files
authored
new(tests): extend tests for CALLF invalid section index (ethereum#1111)
It takes a single test case for `CALLF`'s invalid code section index to separate more specific test and add 2 more cases (one from ethereum/tests).
1 parent 27bab05 commit f10dc9d

File tree

1 file changed

+46
-13
lines changed

1 file changed

+46
-13
lines changed

osaka/eip7692_eof_v1/eip4750_functions/test_code_validation.py

Lines changed: 46 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -129,19 +129,6 @@
129129
],
130130
validity_error=EOFException.INVALID_MAX_STACK_HEIGHT,
131131
),
132-
Container(
133-
name="oob_callf_1",
134-
sections=[
135-
Section.Code(
136-
code=(Op.CALLF[2] + Op.STOP),
137-
),
138-
Section.Code(
139-
code=(Op.RETF),
140-
code_outputs=0,
141-
),
142-
],
143-
validity_error=EOFException.INVALID_CODE_SECTION_INDEX,
144-
),
145132
Container(
146133
name="overflow_code_sections_1",
147134
sections=[
@@ -188,6 +175,52 @@ def test_eof_validity(
188175
eof_test(data=container)
189176

190177

178+
@pytest.mark.parametrize(
179+
"container",
180+
[
181+
Container(
182+
name="callf1", # EOF1I4750_0010
183+
sections=[
184+
Section.Code(
185+
Op.CALLF[1] + Op.STOP,
186+
)
187+
],
188+
),
189+
Container(
190+
name="callf2", # EOF1I0011
191+
sections=[
192+
Section.Code(
193+
Op.CALLF[2] + Op.STOP,
194+
),
195+
Section.Code(
196+
Op.RETF,
197+
code_outputs=0,
198+
),
199+
],
200+
),
201+
Container(
202+
name="callf1_callf2",
203+
sections=[
204+
Section.Code(
205+
Op.CALLF[1] + Op.STOP,
206+
),
207+
Section.Code(
208+
Op.CALLF[2] + Op.RETF,
209+
code_outputs=0,
210+
),
211+
],
212+
),
213+
],
214+
ids=container_name,
215+
)
216+
def test_invalid_code_section_index(
217+
eof_test: EOFTestFiller,
218+
container: Container,
219+
):
220+
"""Test cases for CALLF instructions with invalid target code section index."""
221+
eof_test(data=container, expect_exception=EOFException.INVALID_CODE_SECTION_INDEX)
222+
223+
191224
@pytest.mark.parametrize(
192225
"container",
193226
[

0 commit comments

Comments
 (0)