Skip to content

test_dataloadn_truncated_immediate()

Documentation for tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py::test_dataloadn_truncated_immediate@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_dataloadn_truncated_immediate --fork Osaka

Test cases for DATALOADN instructions with truncated immediate bytes.

Source code in tests/osaka/eip7692_eof_v1/eip7480_data_section/test_code_validation.py
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
@pytest.mark.parametrize(
    "container",
    [
        Container(
            name="imm0",
            sections=[
                Section.Code(Op.DATALOADN),
                Section.Data(b"\xff" * 32),
            ],
        ),
        Container(
            name="imm1",
            sections=[
                Section.Code(Op.DATALOADN + b"\x00"),
                Section.Data(b"\xff" * 32),
            ],
        ),
        Container(
            name="imm_from_next_section",
            sections=[
                Section.Code(
                    Op.CALLF[1] + Op.JUMPF[2],
                    max_stack_height=1,
                ),
                Section.Code(
                    Op.DATALOADN + b"\x00",
                    code_outputs=1,
                ),
                Section.Code(
                    Op.STOP,
                ),
                Section.Data(b"\xff" * 32),
            ],
        ),
    ],
    ids=container_name,
)
def test_dataloadn_truncated_immediate(
    eof_test: EOFTestFiller,
    container: Container,
):
    """Test cases for DATALOADN instructions with truncated immediate bytes."""
    eof_test(container=container, expect_exception=EOFException.TRUNCATED_INSTRUCTION)

Parametrized Test Cases

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

Test ID (Abbreviated) container
...fork_Osaka-eof_test-imm0 imm0
...fork_Osaka-eof_test-imm1 imm1
...fork_Osaka-eof_test-imm_from_next_section imm_from_next_section
...fork_Osaka-state_test_from_eof_test-imm0 imm0
...fork_Osaka-state_test_from_eof_test-imm1 imm1
...fork_Osaka-state_test_from_eof_test-imm_from_next_section imm_from_next_section
...fork_Osaka-blockchain_test_from_eof_test-imm0 imm0
...fork_Osaka-blockchain_test_from_eof_test-imm1 imm1
...fork_Osaka-blockchain_test_from_eof_test-imm_from_next_section imm_from_next_section