Skip to content

test_worst_jumpdests()

Documentation for tests/zkevm/test_worst_compute.py::test_worst_jumpdests@64f949d0.

Generate fixtures for these test cases for Prague with:

fill -v tests/zkevm/test_worst_compute.py::test_worst_jumpdests --fork Prague

Test running a JUMPDEST-intensive contract.

Source code in tests/zkevm/test_worst_compute.py
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
@pytest.mark.zkevm
@pytest.mark.valid_from("Cancun")
@pytest.mark.slow
def test_worst_jumpdests(state_test: StateTestFiller, pre: Alloc, fork: Fork):
    """Test running a JUMPDEST-intensive contract."""
    env = Environment()
    max_code_size = fork.max_code_size()

    # Create and deploy a contract with many JUMPDESTs
    code_suffix = Op.JUMP(Op.PUSH0)
    code_body = Op.JUMPDEST * (max_code_size - len(code_suffix))
    code = code_body + code_suffix
    jumpdests_address = pre.deploy_contract(code=code)

    tx = Transaction(
        to=jumpdests_address,
        gas_limit=env.gas_limit,
        sender=pre.fund_eoa(),
    )

    state_test(
        genesis_environment=env,
        pre=pre,
        post={},
        tx=tx,
    )

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated)
...fork_Cancun-state_test
...fork_Cancun-blockchain_test_from_state_test
...fork_Prague-state_test
...fork_Prague-blockchain_test_from_state_test
...fork_Osaka-state_test
...fork_Osaka-blockchain_test_from_state_test