Skip to content

test_truncated_container_with_data()

Documentation for tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py::test_truncated_container_with_data@verkle@v0.0.6.

Generate fixtures for these test cases for Pragueeip7692 with:

Pragueeip7692 only:

fill -v tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py::test_truncated_container_with_data --fork=PragueEIP7692 --evm-bin=/path/to/evm-tool-dev-version

For all forks up to and including Pragueeip7692:

fill -v tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py::test_truncated_container_with_data --until=PragueEIP7692

This test takes a valid container with data and removes some bytes from its tail. Migrated from EOFTests/efValidation/EOF1_truncated_section_.json (cases with data section).

Source code in tests/prague/eip7692_eof_v1/eip3540_eof_v1/test_section_size.py
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
@pytest.mark.parametrize(
    "truncation_len, exception",
    [
        pytest.param(0, None),
        pytest.param(1, EOFException.TOPLEVEL_CONTAINER_TRUNCATED, id="EOF1_truncated_section_4"),
        pytest.param(2, EOFException.TOPLEVEL_CONTAINER_TRUNCATED, id="EOF1_truncated_section_3"),
    ],
)
def test_truncated_container_with_data(
    eof_test: EOFTestFiller,
    truncation_len: int,
    exception: EOFException,
):
    """
    This test takes a valid container with data and removes some bytes from its tail.
    Migrated from EOFTests/efValidation/EOF1_truncated_section_.json (cases with data section).
    """
    data = b"\xaa\xbb"
    container = Container(
        sections=[
            Section.Code(Op.INVALID),
            Section.Data(data[0 : (len(data) - truncation_len)], custom_size=2),
        ]
    )
    eof_test(
        data=container,
        expect_exception=exception,
    )

Parametrized Test Cases

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

Skipped Parameters

For more concise readability, the table below does not list the following parameter values: fork, blockchain_test, state_test, state_test_only, eof_test, eof_state_test.

Test ID truncation_len exception
truncation_len_0-exception_None 0 None
EOF1_truncated_section_4 1 EOFException.TOPLEVEL_CONTAINER_TRUNCATED
EOF1_truncated_section_3 2 EOFException.TOPLEVEL_CONTAINER_TRUNCATED