Skip to content

test_subcontainer_wrong_size()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py::test_subcontainer_wrong_size@83970623.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py::test_subcontainer_wrong_size --fork Osaka

Test a subcontainer with the incorrect size in the parent's header.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
@pytest.mark.parametrize("delta", [-1, 1], ids=["smaller", "larger"])
@pytest.mark.parametrize("kind", [ContainerKind.RUNTIME, ContainerKind.INITCODE])
def test_subcontainer_wrong_size(
    eof_test: EOFTestFiller,
    delta: int,
    kind: ContainerKind,
):
    """Test a subcontainer with the incorrect size in the parent's header."""
    eof_test(
        container=Container(
            sections=[
                Section.Code(
                    code=(Op.EOFCREATE[0](0, 0, 0, 0) + Op.STOP)
                    if kind == ContainerKind.RUNTIME
                    else (Op.RETURNCONTRACT[0](0, 0)),
                ),
                Section.Container(
                    container=Container(sections=[Section.Code(code=Op.STOP)]),
                    custom_size=len(stop_sub_container.data) + delta,
                ),
            ],
            kind=kind,
        ),
        expect_exception=EOFException.INVALID_SECTION_BODIES_SIZE,
    )

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) kind delta
...fork_Osaka-eof_test-kind_RUNTIME-smaller RUNTIME -1
...fork_Osaka-eof_test-kind_RUNTIME-larger RUNTIME 1
...fork_Osaka-eof_test-kind_INITCODE-smaller INITCODE -1
...fork_Osaka-eof_test-kind_INITCODE-larger INITCODE 1