Skip to content

test_eofcreate_truncated_container()

Documentation for tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py::test_eofcreate_truncated_container@3719e927.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py::test_eofcreate_truncated_container --fork Osaka

EOFCREATE instruction targeting a container with truncated data section.

Source code in tests/osaka/eip7692_eof_v1/eip7620_eof_create/test_eofcreate.py
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
@pytest.mark.parametrize(
    ["data_len", "data_section_size"],
    [
        (0, 1),
        (0, 0xFFFF),
        (2, 3),
        (2, 0xFFFF),
    ],
)
def test_eofcreate_truncated_container(
    eof_test: EOFTestFiller,
    data_len: int,
    data_section_size: int,
):
    """EOFCREATE instruction targeting a container with truncated data section."""
    assert data_len < data_section_size
    eof_test(
        container=Container(
            sections=[
                Section.Code(Op.EOFCREATE[0](0, 0, 0, 0) + Op.STOP),
                Section.Container(
                    Container(
                        sections=[
                            Section.Code(Op.INVALID),
                            Section.Data(b"\xda" * data_len, custom_size=data_section_size),
                        ],
                    )
                ),
            ],
        ),
        expect_exception=EOFException.EOFCREATE_WITH_TRUNCATED_CONTAINER,
    )

Parametrized Test Cases

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

Test ID (Abbreviated) data_len data_section_size
...fork_Osaka-eof_test-data_len_0-data_section_size_1 0 1
...fork_Osaka-eof_test-data_len_0-data_section_size_65535 0 65535
...fork_Osaka-eof_test-data_len_2-data_section_size_3 2 3
...fork_Osaka-eof_test-data_len_2-data_section_size_65535 2 65535
...fork_Osaka-state_test_from_eof_test-data_len_0-data_section_size_1 0 1
...fork_Osaka-state_test_from_eof_test-data_len_0-data_section_size_65535 0 65535
...fork_Osaka-state_test_from_eof_test-data_len_2-data_section_size_3 2 3
...fork_Osaka-state_test_from_eof_test-data_len_2-data_section_size_65535 2 65535
...fork_Osaka-blockchain_test_from_eof_test-data_len_0-data_section_size_1 0 1
...fork_Osaka-blockchain_test_from_eof_test-data_len_0-data_section_size_65535 0 65535
...fork_Osaka-blockchain_test_from_eof_test-data_len_2-data_section_size_3 2 3
...fork_Osaka-blockchain_test_from_eof_test-data_len_2-data_section_size_65535 2 65535