Skip to content

test_rjumpi_condition_zero()

Documentation for tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpi.py::test_rjumpi_condition_zero@49a16fac.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpi.py::test_rjumpi_condition_zero --fork Osaka

Test RJUMPI contract switching based on external input (condition zero).

Source code in tests/osaka/eip7692_eof_v1/eip4200_relative_jumps/test_rjumpi.py
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
@pytest.mark.parametrize(
    "calldata",
    [pytest.param(b"\x00", id="False"), pytest.param(b"\x01", id="True")],
)
def test_rjumpi_condition_zero(
    state_test: StateTestFiller,
    pre: Alloc,
    calldata: bytes,
):
    """Test RJUMPI contract switching based on external input (condition zero)."""
    env = Environment()
    sender = pre.fund_eoa(10**18)
    contract_address = pre.deploy_contract(
        code=Container(
            sections=[
                Section.Code(
                    code=Op.PUSH0
                    + Op.CALLDATALOAD
                    + Op.RJUMPI[0]
                    + Op.SSTORE(slot_code_worked, value_code_worked)
                    + Op.STOP,
                )
            ]
        ),
    )
    tx = Transaction(
        to=contract_address,
        gas_limit=10_000_000,
        data=calldata,
        sender=sender,
    )
    post = {contract_address: Account(storage={slot_code_worked: value_code_worked})}
    state_test(env=env, tx=tx, pre=pre, post=post)

Parametrized Test Cases

The interactive table below is also available as a standalone page.

Test ID (Abbreviated) calldata
...fork_Osaka-blockchain_test-False 00
...fork_Osaka-blockchain_test-True 01
...fork_Osaka-state_test-False 00
...fork_Osaka-state_test-True 01