Skip to content

test_deep_container()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py::test_deep_container@b48d1dc8.

Generate fixtures for these test cases for Osaka with:

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

Test a very deeply nested container.

This test skips generating a state test because the initcode size is too large.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
@deep_container_parametrize
@pytest.mark.eof_test_only(reason="Initcontainer exceeds maximum")
def test_deep_container(
    eof_test: EOFTestFiller, deepest_container: Container, exception: EOFException | None
):
    """
    Test a very deeply nested container.

    This test skips generating a state test because the initcode size is too large.
    """
    container = deepest_container
    last_container = deepest_container
    while len(container) < MAX_INITCODE_SIZE:
        last_container = container
        container = Container(
            sections=[
                Section.Code(
                    code=Op.PUSH0 + Op.PUSH0 + Op.PUSH0 + Op.PUSH0 + Op.EOFCREATE[0] + Op.STOP,
                ),
                Section.Container(
                    container=Container(
                        sections=[
                            Section.Code(
                                code=Op.PUSH0 + Op.PUSH0 + Op.RETURNCODE[0],
                            ),
                            Section.Container(container=last_container),
                        ]
                    )
                ),
            ],
        )

    eof_test(container=last_container, expect_exception=exception)

Parametrized Test Cases

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

Test ID (Abbreviated) deepest_container exception
...fork_Osaka-eof_test-valid b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\xff\x00\x00\x00\x00\x80\x00\x00\x00' None
...fork_Osaka-eof_test-code-error b'\xef\x00\x01\x01\x00\x04\x02\x00\x01\x00\x01\xff\x00\x00\x00\x00\x80\x00\x01_' EOFException.MISSING_STOP_OPCODE
...fork_Osaka-eof_test-structure-error 0xef0100a94f5374fce5edbc8e2a8697c15331677e6ebf0b EOFException.INVALID_MAGIC