Skip to content

Commit 4b93082

Browse files
authored
feat(tests): EOF - EIP-7620: Incompatible container kind validation error (#662)
1 parent db112a8 commit 4b93082

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

src/ethereum_test_tools/exceptions/evmone_exceptions.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ class EvmoneExceptionMapper:
8080
ExceptionMessage(
8181
EOFException.INVALID_CONTAINER_SECTION_INDEX, "err: invalid_container_section_index"
8282
),
83+
ExceptionMessage(
84+
EOFException.INCOMPATIBLE_CONTAINER_KIND, "err: incompatible_container_kind"
85+
),
8386
)
8487

8588
def __init__(self) -> None:

src/ethereum_test_tools/exceptions/exceptions.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,10 @@ class EOFException(ExceptionBase):
700700
"""
701701
Instruction references container section that does not exist.
702702
"""
703+
INCOMPATIBLE_CONTAINER_KIND = auto()
704+
"""
705+
Incompatible instruction found in a container of a specific kind.
706+
"""
703707

704708

705709
"""

tests/prague/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,24 +187,21 @@ def test_container_combos_valid(
187187

188188

189189
@pytest.mark.parametrize(
190-
"code_section,first_sub_container,error",
190+
"code_section,first_sub_container",
191191
[
192192
pytest.param(
193193
eofcreate_code_section,
194194
stop_sub_container,
195-
EOFException.UNDEFINED_EXCEPTION,
196195
id="EOFCREATE/STOP",
197196
),
198197
pytest.param(
199198
eofcreate_code_section,
200199
return_sub_container,
201-
EOFException.UNDEFINED_EXCEPTION,
202200
id="EOFCREATE/RETURN",
203201
),
204202
pytest.param(
205203
returncontract_code_section,
206204
returncontract_sub_container,
207-
EOFException.UNDEFINED_EXCEPTION,
208205
id="RETURNCONTRACT/RETURNCONTRACT",
209206
),
210207
],
@@ -213,7 +210,6 @@ def test_container_combos_invalid(
213210
eof_test: EOFTestFiller,
214211
code_section: Section,
215212
first_sub_container: Container,
216-
error: EOFException,
217213
):
218214
"""Test invalid subcontainer reference / opcode combos"""
219215
eof_test(
@@ -223,7 +219,7 @@ def test_container_combos_invalid(
223219
first_sub_container,
224220
],
225221
),
226-
expect_exception=error,
222+
expect_exception=EOFException.INCOMPATIBLE_CONTAINER_KIND,
227223
)
228224

229225

@@ -241,7 +237,7 @@ def test_container_both_kinds_same_sub(eof_test: EOFTestFiller):
241237
revert_sub_container,
242238
],
243239
),
244-
expect_exception=EOFException.UNDEFINED_EXCEPTION,
240+
expect_exception=EOFException.INCOMPATIBLE_CONTAINER_KIND,
245241
)
246242

247243

0 commit comments

Comments
 (0)