Skip to content

test_wide_container()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py::test_wide_container@bc691d13.

Generate fixtures for these test cases for Osaka with:

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

Test a container with the maximum number of sub-containers.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
@pytest.mark.parametrize(
    ["width", "exception"],
    [
        pytest.param(256, None, id="256"),
        pytest.param(257, EOFException.TOO_MANY_CONTAINERS, id="257"),
        pytest.param(
            0x8000,
            EOFException.CONTAINER_SIZE_ABOVE_LIMIT,
            marks=pytest.mark.eof_test_only(reason="int too big to convert"),
            id="negative_i16",
        ),
        pytest.param(
            0xFFFF,
            EOFException.CONTAINER_SIZE_ABOVE_LIMIT,
            marks=pytest.mark.eof_test_only(reason="int too big to convert"),
            id="max_u16",
        ),
    ],
)
def test_wide_container(eof_test: EOFTestFiller, width: int, exception: EOFException):
    """Test a container with the maximum number of sub-containers."""
    create_code: Bytecode = Op.STOP
    for x in range(0, 256):
        create_code = Op.EOFCREATE[x](0, 0, 0, 0) + create_code
    eof_test(
        container=Container(
            sections=[
                Section.Code(
                    code=create_code,
                ),
                *(
                    [
                        Section.Container(
                            container=Container(
                                sections=[
                                    Section.Code(
                                        code=Op.PUSH0 + Op.PUSH0 + Op.RETURNCODE[0],
                                    ),
                                    stop_sub_container,
                                ]
                            )
                        )
                    ]
                    * width
                ),
            ]
        ),
        expect_exception=exception,
    )

Parametrized Test Cases

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

Test ID (Abbreviated) width exception
...fork_Osaka-eof_test-256 256 None
...fork_Osaka-eof_test-257 257 EOFException.TOO_MANY_CONTAINERS
...fork_Osaka-eof_test-negative_i16 32768 EOFException.CONTAINER_SIZE_ABOVE_LIMIT
...fork_Osaka-eof_test-max_u16 65535 EOFException.CONTAINER_SIZE_ABOVE_LIMIT
...fork_Osaka-state_test_from_eof_test-256 256 None
...fork_Osaka-state_test_from_eof_test-257 257 EOFException.TOO_MANY_CONTAINERS
...fork_Osaka-blockchain_test_from_eof_test-256 256 None
...fork_Osaka-blockchain_test_from_eof_test-257 257 EOFException.TOO_MANY_CONTAINERS