test_alt_bn128_benchmark()
Documentation for tests/benchmark/compute/precompile/test_alt_bn128.py::test_alt_bn128_benchmark@ffe48572.
Generate fixtures for these test cases for Bogota with:
fill -v tests/benchmark/compute/precompile/test_alt_bn128.py::test_alt_bn128_benchmark --gas-benchmark-values 1
Benchmark BN128 pairings precompile with varying number of pairs.
Source code in tests/benchmark/compute/precompile/test_alt_bn128.py
| @pytest.mark.repricing
@pytest.mark.parametrize("num_pairs", [1, 3, 6, 12, 24])
def test_alt_bn128_benchmark(
benchmark_test: BenchmarkTestFiller,
num_pairs: int,
) -> None:
"""Benchmark BN128 pairings precompile with varying number of pairs."""
calldata = _generate_bn128_pairs(num_pairs, seed=42)
attack_block = Op.POP(
Op.STATICCALL(
gas=Op.GAS,
address=EIP197Spec.ECPAIRING,
args_size=Op.CALLDATASIZE,
),
)
benchmark_test(
target_opcode=Precompile.BN128_PAIRING,
code_generator=JumpLoopGenerator(
setup=Op.CALLDATACOPY(0, 0, Op.CALLDATASIZE),
attack_block=attack_block,
tx_kwargs={"data": calldata},
),
)
|
Parametrized Test Cases
This test generates 5 parametrized test cases across 4 forks.