Skip to content

test_ripemd160_fixed_size()

Documentation for tests/benchmark/compute/precompile/test_ripemd160.py::test_ripemd160_fixed_size@20373115.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/benchmark/compute/precompile/test_ripemd160.py::test_ripemd160_fixed_size --gas-benchmark-values 1

Benchmark RIPEMD160 with fixed size input.

Source code in tests/benchmark/compute/precompile/test_ripemd160.py
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
@pytest.mark.repricing
@pytest.mark.parametrize("size", [0, 32, 64, 256, 1024])
def test_ripemd160_fixed_size(
    benchmark_test: BenchmarkTestFiller, size: int
) -> None:
    """Benchmark RIPEMD160 with fixed size input."""
    attack_block = Op.POP(
        Op.STATICCALL(
            Op.GAS,
            PrecompilesSpec.RIPEMD160,
            Op.PUSH0,
            size,
            Op.PUSH0,
            Op.PUSH0,
        )
    )

    benchmark_test(
        target_opcode=Precompile.RIPEMD160,
        code_generator=JumpLoopGenerator(
            setup=Op.CODECOPY(0, 0, size), attack_block=attack_block
        ),
    )

Parametrized Test Cases

This test generates 5 parametrized test cases across 3 forks.