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@3719e927.

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
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
@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.RETURNCODE[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
...fork_Osaka-state_test_from_eof_test-kind_RUNTIME-smaller RUNTIME -1
...fork_Osaka-state_test_from_eof_test-kind_RUNTIME-larger RUNTIME 1
...fork_Osaka-state_test_from_eof_test-kind_INITCODE-smaller INITCODE -1
...fork_Osaka-state_test_from_eof_test-kind_INITCODE-larger INITCODE 1
...fork_Osaka-blockchain_test_from_eof_test-kind_RUNTIME-smaller RUNTIME -1
...fork_Osaka-blockchain_test_from_eof_test-kind_RUNTIME-larger RUNTIME 1
...fork_Osaka-blockchain_test_from_eof_test-kind_INITCODE-smaller INITCODE -1
...fork_Osaka-blockchain_test_from_eof_test-kind_INITCODE-larger INITCODE 1