Skip to content

test_rjumpv_into_returncode()

Documentation for tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py::test_rjumpv_into_returncode@14a7429a.

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

EOF code containing RJUMPV with target RETURNCODE immediate.

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpv.py
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
@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_returncode(
    eof_test: EOFTestFiller,
    table_size: int,
    invalid_index: int,
):
    """EOF code containing RJUMPV with target RETURNCODE 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.EOFCREATE[0](0, 0, 0, 0) + Op.STOP,
                ),
                Section.Container(
                    container=Container(
                        sections=[
                            Section.Code(
                                code=Op.PUSH0 * 3 + Op.RJUMPV[jump_table] + Op.RETURNCODE[0],
                            ),
                            Section.Container(
                                container=Container.Code(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