Skip to content

Commit

Permalink
new(tests): EOF - EIP-7620: Dangling data in subcontainer test (#812)
Browse files Browse the repository at this point in the history
* Dangling data in subcontainer test

Test dangling data inside a subcontainer

Signed-off-by: Danno Ferrin <danno@numisight.com>

* style fix

Signed-off-by: Danno Ferrin <danno@numisight.com>

* remove duplicate test

Signed-off-by: Danno Ferrin <danno@numisight.com>

* sections sizes should match

Signed-off-by: Danno Ferrin <danno@numisight.com>

---------

Signed-off-by: Danno Ferrin <danno@numisight.com>
  • Loading branch information
shemnon committed Sep 18, 2024
1 parent be613a0 commit b48db3c
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -789,3 +789,42 @@ def test_migrated_eofcreate(eof_test: EOFTestFiller, container: Container):
Tests migrated from EOFTests/efValidation/EOF1_eofcreate_valid_.json.
"""
eof_test(data=container, expect_exception=container.validity_error)


def test_dangling_initcode_subcontainer_bytes(
eof_test: EOFTestFiller,
):
"""Initcode mode EOF Subcontainer test with subcontainer containing dangling bytes."""
eof_test(
data=Container(
sections=[
returncontract_code_section,
Section.Container(
container=Container(
raw_bytes=stop_sub_container.data + b"\x99",
),
),
],
kind=ContainerKind.INITCODE,
),
expect_exception=EOFException.INVALID_SECTION_BODIES_SIZE,
)


def test_dangling_runtime_subcontainer_bytes(
eof_test: EOFTestFiller,
):
"""Runtime mode EOF Subcontainer test with subcontainer containing dangling bytes."""
eof_test(
data=Container(
sections=[
eofcreate_code_section,
Section.Container(
container=Container(
raw_bytes=returncontract_sub_container.data + b"\x99",
),
),
],
),
expect_exception=EOFException.INVALID_SECTION_BODIES_SIZE,
)

0 comments on commit b48db3c

Please sign in to comment.