Skip to content

test_worst_calldataload()

Documentation for tests/benchmark/test_worst_compute.py::test_worst_calldataload@88e9fb8f.

Generate fixtures for these test cases for Osaka with:

fill -v tests/benchmark/test_worst_compute.py::test_worst_calldataload -m benchmark

Test running a block with as many CALLDATALOAD as possible.

Source code in tests/benchmark/test_worst_compute.py
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
@pytest.mark.parametrize(
    "calldata",
    [
        pytest.param(b"", id="empty"),
        pytest.param(b"\x00", id="zero-loop"),
        pytest.param(b"\x00" * 31 + b"\x20", id="one-loop"),
    ],
)
def test_worst_calldataload(
    benchmark_test: BenchmarkTestFiller,
    calldata: bytes,
) -> None:
    """Test running a block with as many CALLDATALOAD as possible."""
    benchmark_test(
        code_generator=JumpLoopGenerator(
            setup=Op.PUSH0,
            attack_block=Op.CALLDATALOAD,
            tx_kwargs={"data": calldata},
        ),
    )

Parametrized Test Cases

This test case is only parametrized by fork.

Test ID (Abbreviated) calldata
...fork_Prague-blockchain_test-empty
...fork_Prague-blockchain_test-zero-loop 00
...fork_Prague-blockchain_test-one-loop 00000000000000000000000000000000 00000000000000000000000000000020
...fork_Osaka-blockchain_test-empty
...fork_Osaka-blockchain_test-zero-loop 00
...fork_Osaka-blockchain_test-one-loop 00000000000000000000000000000000 00000000000000000000000000000020