Skip to content

test_rjumpv_into_rjumpv()

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

EOF1I4200_0040 (Invalid) EOF code containing RJUMPV with target other RJUMPV immediate.

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
@pytest.mark.parametrize(
    "source_table_size,invalid_index",
    [
        pytest.param(1, 0, id="s1i0"),
        pytest.param(256, 0, id="s256i0"),
        pytest.param(256, 255, id="s256i255"),
    ],
)
@pytest.mark.parametrize("target_table_size", [1, 256], ids=["t1", "t256"])
@pytest.mark.parametrize(
    "data_portion_end",
    [True, False],
    ids=["data_portion_end", "data_portion_start"],
)
def test_rjumpv_into_rjumpv(
    eof_test: EOFTestFiller,
    source_table_size: int,
    target_table_size: int,
    invalid_index: int,
    data_portion_end: bool,
):
    """EOF1I4200_0040 (Invalid) EOF code containing RJUMPV with target other RJUMPV immediate."""
    invalid_destination = 4 + (2 * target_table_size) if data_portion_end else 4
    source_jump_table = [0 for _ in range(source_table_size)]
    source_jump_table[invalid_index] = invalid_destination
    target_jump_table = [0 for _ in range(target_table_size)]
    eof_test(
        container=Container(
            sections=[
                Section.Code(
                    code=Op.PUSH1(1)
                    + Op.RJUMPV[source_jump_table]
                    + Op.STOP
                    + Op.PUSH1(1)
                    + Op.RJUMPV[target_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 target_table_size source_table_size invalid_index
...fork_Osaka-eof_test-data_portion_end-t1-s1i0 True 1 1 0
...fork_Osaka-eof_test-data_portion_end-t1-s256i0 True 1 256 0
...fork_Osaka-eof_test-data_portion_end-t1-s256i255 True 1 256 255
...fork_Osaka-eof_test-data_portion_end-t256-s1i0 True 256 1 0
...fork_Osaka-eof_test-data_portion_end-t256-s256i0 True 256 256 0
...fork_Osaka-eof_test-data_portion_end-t256-s256i255 True 256 256 255
...fork_Osaka-eof_test-data_portion_start-t1-s1i0 False 1 1 0
...fork_Osaka-eof_test-data_portion_start-t1-s256i0 False 1 256 0
...fork_Osaka-eof_test-data_portion_start-t1-s256i255 False 1 256 255
...fork_Osaka-eof_test-data_portion_start-t256-s1i0 False 256 1 0
...fork_Osaka-eof_test-data_portion_start-t256-s256i0 False 256 256 0
...fork_Osaka-eof_test-data_portion_start-t256-s256i255 False 256 256 255