test_blake2f()
Documentation for tests/benchmark/compute/precompile/test_blake2f.py::test_blake2f@892e6d1e.
Generate fixtures for these test cases for Amsterdam with:
fill -v tests/benchmark/compute/precompile/test_blake2f.py::test_blake2f --gas-benchmark-values 1
Benchmark BLAKE2F precompile.
Source code in tests/benchmark/compute/precompile/test_blake2f.py
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64 | @pytest.mark.parametrize(
"precompile_address,calldata",
[
pytest.param(
Blake2bSpec.BLAKE2_PRECOMPILE_ADDRESS,
concatenate_parameters(
[
Blake2bInput(
rounds=0xFFFF, f=True
).create_blake2b_tx_data(),
]
),
id="blake2f",
),
],
)
def test_blake2f(
benchmark_test: BenchmarkTestFiller,
fork: Fork,
precompile_address: Address,
calldata: bytes,
) -> None:
"""Benchmark BLAKE2F precompile."""
if precompile_address not in fork.precompiles():
pytest.skip("Precompile not enabled")
attack_block = Op.POP(
Op.STATICCALL(
gas=Op.GAS, address=precompile_address, args_size=Op.CALLDATASIZE
),
)
benchmark_test(
target_opcode=Precompile.BLAKE2F,
code_generator=JumpLoopGenerator(
setup=Op.CALLDATACOPY(0, 0, Op.CALLDATASIZE),
attack_block=attack_block,
tx_kwargs={"data": calldata},
),
)
|
Parametrized Test Cases
This test generates 1 parametrized test case across 3 forks.