Skip to content

test_deep_container_initcode()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py::test_deep_container_initcode@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_deep_container_initcode --fork Osaka

Test a very deeply nested initcontainer.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_subcontainer_validation.py
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
@deep_container_parametrize
def test_deep_container_initcode(
    eof_test: EOFTestFiller, deepest_container: Container, exception: EOFException | None
):
    """Test a very deeply nested initcontainer."""
    container = Container(
        sections=[
            Section.Code(
                code=Op.PUSH0 + Op.PUSH0 + Op.RETURNCODE[0],
            ),
            Section.Container(container=deepest_container),
        ],
        kind=ContainerKind.INITCODE,
    )
    last_container = container
    while len(container) < MAX_INITCODE_SIZE:
        last_container = container
        container = Container(
            sections=[
                Section.Code(
                    code=Op.PUSH0 + Op.PUSH0 + Op.RETURNCODE[0],
                ),
                Section.Container(
                    container=Container(
                        sections=[
                            Section.Code(
                                code=Op.PUSH0
                                + Op.PUSH0
                                + Op.PUSH0
                                + Op.PUSH0
                                + Op.EOFCREATE[0]
                                + Op.STOP
                            ),
                            Section.Container(container=last_container),
                        ]
                    )
                ),
            ],
            kind=ContainerKind.INITCODE,
        )
    eof_test(
        container=last_container,
        expect_exception=exception,
        deployed_container=None,
    )

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
...fork_Osaka-state_test_from_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-state_test_from_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-state_test_from_eof_test-structure-error 0xef0100a94f5374fce5edbc8e2a8697c15331677e6ebf0b EOFException.INVALID_MAGIC
...fork_Osaka-blockchain_test_from_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-blockchain_test_from_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-blockchain_test_from_eof_test-structure-error 0xef0100a94f5374fce5edbc8e2a8697c15331677e6ebf0b EOFException.INVALID_MAGIC