Skip to content

test_rjumpv_into_exchange()

Documentation for tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py::test_rjumpv_into_exchange@bc691d13.

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

EOF code containing RJUMPV with target EXCHANGE immediate.

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
@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_exchange(
    eof_test: EOFTestFiller,
    table_size: int,
    invalid_index: int,
):
    """EOF code containing RJUMPV with target EXCHANGE immediate."""
    invalid_destination = 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.PUSH1(2)
                    + Op.PUSH1(3)
                    + Op.PUSH1(0)
                    + Op.RJUMPV[jump_table]
                    + Op.EXCHANGE[0x00]
                    + Op.SSTORE
                    + 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
...fork_Osaka-eof_test-t1i0 1 0
...fork_Osaka-eof_test-t256i0 256 0
...fork_Osaka-eof_test-t256i255 256 255
...fork_Osaka-state_test_from_eof_test-t1i0 1 0
...fork_Osaka-state_test_from_eof_test-t256i0 256 0
...fork_Osaka-state_test_from_eof_test-t256i255 256 255
...fork_Osaka-blockchain_test_from_eof_test-t1i0 1 0
...fork_Osaka-blockchain_test_from_eof_test-t256i0 256 0
...fork_Osaka-blockchain_test_from_eof_test-t256i255 256 255