Skip to content

test_rjumpv_into_data()

Documentation for tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py::test_rjumpv_into_data@21fb11c8.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py::test_rjumpv_into_data --fork Osaka

EOF1I4200_0033 (Invalid) EOF code containing RJUMPV with target outside code bounds (Jumping into data section).

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
@pytest.mark.parametrize(
    "table_size,invalid_index",
    [
        pytest.param(1, 0, id="t1i0"),
        pytest.param(256, 0, id="t256i0"),
        pytest.param(256, 255, id="t256i255"),
    ],
)
def test_rjumpv_into_data(
    eof_test: EOFTestFiller,
    table_size: int,
    invalid_index: int,
):
    """
    EOF1I4200_0033 (Invalid) EOF code containing RJUMPV with target outside code bounds
    (Jumping into data section).
    """
    invalid_destination = 2
    jump_table = [0 for _ in range(table_size)]
    jump_table[invalid_index] = invalid_destination
    eof_test(
        container=Container(
            sections=[
                Section.Code(
                    code=Op.PUSH1(1) + Op.RJUMPV[jump_table] + Op.STOP,
                ),
                Section.Data(data=b"\xaa\xbb\xcc"),
            ],
        ),
        expect_exception=EOFException.INVALID_RJUMP_DESTINATION,
    )

Parametrized Test Cases

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

Test ID (Abbreviated) table_size invalid_index
...fork_Osaka-eof_test-t1i0 1 0
...fork_Osaka-eof_test-t256i0 256 0
...fork_Osaka-eof_test-t256i255 256 255