Skip to content

test_rjumpv_into_rjump()

Documentation for tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py::test_rjumpv_into_rjump@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_rjump --fork Osaka

EOF1I4200_0037 (Invalid) EOF code containing RJUMPV with target RJUMP immediate.

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
@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_rjump(
    eof_test: EOFTestFiller,
    table_size: int,
    invalid_index: int,
    data_portion_end: bool,
):
    """EOF1I4200_0037 (Invalid) EOF code containing RJUMPV with target RJUMP immediate."""
    invalid_destination = 3 if data_portion_end else 2
    jump_table = [0 for _ in range(table_size)]
    jump_table[invalid_index] = invalid_destination
    if table_size > 1:
        valid_index = 0
        if valid_index == invalid_index:
            valid_index += 1
        jump_table[valid_index] = 1
    eof_test(
        container=Container(
            sections=[
                Section.Code(
                    code=Op.PUSH1(1) + Op.RJUMPV[jump_table] + Op.STOP + Op.RJUMP[0] + 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