test_calldatasize()
Documentation for tests/benchmark/compute/instruction/test_call_context.py::test_calldatasize@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/benchmark/compute/instruction/test_call_context.py::test_calldatasize --gas-benchmark-values 1
Benchmark CALLDATASIZE instruction.
Source code in tests/benchmark/compute/instruction/test_call_context.py
| @pytest.mark.repricing(zero_data=True)
@pytest.mark.parametrize("calldata_size", [0, 32, 256, 1024])
@pytest.mark.parametrize("zero_data", [True, False])
def test_calldatasize(
benchmark_test: BenchmarkTestFiller, calldata_size: int, zero_data: bool
) -> None:
"""Benchmark CALLDATASIZE instruction."""
calldata = (
b"\x00" * calldata_size
if zero_data
else Bytes([i % 256 for i in range(calldata_size)])
)
benchmark_test(
target_opcode=Op.CALLDATASIZE,
code_generator=ExtCallGenerator(
attack_block=Op.CALLDATASIZE,
tx_kwargs={"data": calldata},
),
)
|
Parametrized Test Cases
This test generates 8 parametrized test cases across 4 forks.