Skip to content

test_rjumpv_before_container()

Documentation for tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py::test_rjumpv_before_container@49a16fac.

Generate fixtures for these test cases for Osaka with:

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

EOF1I4200_0032 (Invalid) EOF code containing RJUMPV with target outside code bounds (Jumping to before code begin).

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
@pytest.mark.parametrize("offset", [-13, -23])
@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_before_container(
    eof_test: EOFTestFiller,
    table_size: int,
    invalid_index: int,
    offset: int,
):
    """
    EOF1I4200_0032 (Invalid) EOF code containing RJUMPV with target outside code bounds
    (Jumping to before code begin).
    """
    invalid_destination = offset - (2 * table_size)
    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,
                )
            ],
        ),
        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 offset
...fork_Osaka-eof_test-t1i0-offset_-13 1 0 -13
...fork_Osaka-eof_test-t1i0-offset_-23 1 0 -23
...fork_Osaka-eof_test-t256i0-offset_-13 256 0 -13
...fork_Osaka-eof_test-t256i0-offset_-23 256 0 -23
...fork_Osaka-eof_test-t256i255-offset_-13 256 255 -13
...fork_Osaka-eof_test-t256i255-offset_-23 256 255 -23