Skip to content

test_valid_containers_with_data_section()

Documentation for tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py::test_valid_containers_with_data_section@01f496f4.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py::test_valid_containers_with_data_section --fork Osaka

Test EOF validation of valid containers with data sections.

Source code in tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
@pytest.mark.parametrize(
    "container",
    [
        Container(
            name="empty_data_section",
            sections=[
                Section.Code(
                    code=Op.ADDRESS + Op.POP + Op.STOP,
                ),
                Section.Data(data=""),
            ],
        ),
        Container(
            name="small_data_section",
            sections=[
                Section.Code(
                    code=Op.ADDRESS + Op.POP + Op.STOP,
                ),
                Section.Data(data="1122334455667788" * 4),
            ],
        ),
        pytest.param(
            Container(
                name="large_data_section",
                sections=[
                    Section.Code(
                        code=Op.ADDRESS + Op.POP + Op.STOP,
                    ),
                    Section.Data(data="1122334455667788" * 3 * 1024),
                ],
            ),
            marks=pytest.mark.eof_test_only(reason="initcode exceeds max size"),
        ),
        pytest.param(
            Container(
                name="max_data_section",
                sections=[
                    Section.Code(code=Op.STOP),
                    # Hits the 49152 bytes limit for the entire container
                    Section.Data(
                        data=b"\x00" * (MAX_INITCODE_SIZE - len(smallest_runtime_subcontainer))
                    ),
                ],
            ),
            marks=pytest.mark.eof_test_only(reason="initcode exceeds max size"),
        ),
        Container(
            name="DATALOADN_zero",
            sections=[
                Section.Code(
                    code=Op.DATALOADN[0] + Op.POP + Op.STOP,
                ),
                Section.Data(data="1122334455667788" * 16),
            ],
        ),
        Container(
            name="DATALOADN_middle",
            sections=[
                Section.Code(
                    code=Op.DATALOADN[16] + Op.POP + Op.STOP,
                ),
                Section.Data(data="1122334455667788" * 16),
            ],
        ),
        Container(
            name="DATALOADN_edge",
            sections=[
                Section.Code(
                    code=Op.DATALOADN[128 - 32] + Op.POP + Op.STOP,
                ),
                Section.Data(data="1122334455667788" * 16),
            ],
        ),
    ],
    ids=container_name,
)
def test_valid_containers_with_data_section(
    eof_test: EOFTestFiller,
    container: Container,
):
    """Test EOF validation of valid containers with data sections."""
    assert container.validity_error is None, (
        f"Valid container with validity error: {container.validity_error}"
    )
    eof_test(
        container=container,
    )

Parametrized Test Cases

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

Test ID (Abbreviated) container
...fork_Osaka-eof_test-empty_data_section empty_data_section
...fork_Osaka-eof_test-small_data_section small_data_section
...fork_Osaka-eof_test-large_data_section large_data_section
...fork_Osaka-eof_test-max_data_section max_data_section
...fork_Osaka-eof_test-DATALOADN_zero DATALOADN_zero
...fork_Osaka-eof_test-DATALOADN_middle DATALOADN_middle
...fork_Osaka-eof_test-DATALOADN_edge DATALOADN_edge
...fork_Osaka-state_test_from_eof_test-empty_data_section empty_data_section
...fork_Osaka-state_test_from_eof_test-small_data_section small_data_section
...fork_Osaka-state_test_from_eof_test-DATALOADN_zero DATALOADN_zero
...fork_Osaka-state_test_from_eof_test-DATALOADN_middle DATALOADN_middle
...fork_Osaka-state_test_from_eof_test-DATALOADN_edge DATALOADN_edge
...fork_Osaka-blockchain_test_from_eof_test-empty_data_section empty_data_section
...fork_Osaka-blockchain_test_from_eof_test-small_data_section small_data_section
...fork_Osaka-blockchain_test_from_eof_test-DATALOADN_zero DATALOADN_zero
...fork_Osaka-blockchain_test_from_eof_test-DATALOADN_middle DATALOADN_middle
...fork_Osaka-blockchain_test_from_eof_test-DATALOADN_edge DATALOADN_edge