Skip to content

test_rjumpv_into_self_data_portion()

Documentation for tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py::test_rjumpv_into_self_data_portion@83970623.

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_self_data_portion --fork Osaka

EOF1I4200_0036 (Invalid) EOF code containing RJUMPV with target same RJUMPV immediate.

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
@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"),
    ],
)
@pytest.mark.parametrize(
    "data_portion_end",
    [True, False],
    ids=["data_portion_end", "data_portion_start"],
)
def test_rjumpv_into_self_data_portion(
    eof_test: EOFTestFiller,
    table_size: int,
    invalid_index: int,
    data_portion_end: bool,
):
    """EOF1I4200_0036 (Invalid) EOF code containing RJUMPV with target same RJUMPV immediate."""
    invalid_destination = -1 if data_portion_end else -(2 * table_size) - 1
    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) data_portion_end table_size invalid_index
...fork_Osaka-eof_test-data_portion_end-t1i0 True 1 0
...fork_Osaka-eof_test-data_portion_end-t256i0 True 256 0
...fork_Osaka-eof_test-data_portion_end-t256i255 True 256 255
...fork_Osaka-eof_test-data_portion_start-t1i0 False 1 0
...fork_Osaka-eof_test-data_portion_start-t256i0 False 256 0
...fork_Osaka-eof_test-data_portion_start-t256i255 False 256 255