Skip to content

test_point_evaluation()

Documentation for tests/benchmark/compute/precompile/test_point_evaluation.py::test_point_evaluation@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

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

Benchmark POINT EVALUATION precompile.

Source code in tests/benchmark/compute/precompile/test_point_evaluation.py
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
@pytest.mark.repricing
@pytest.mark.parametrize(
    "precompile_address,calldata",
    [
        pytest.param(
            BlobsSpec.POINT_EVALUATION_PRECOMPILE_ADDRESS,
            PointEvaluationInput(
                versioned_hash=bytes.fromhex(
                    "01E798154708FE7789429634053CBF9F"
                    "99B619F9F084048927333FCE637F549B"
                ),
                z=0x564C0A11A0F704F4FC3E8ACFE0F8245F0AD1347B378FBF96E206DA11A5D36306,
                y=0x24D25032E67A7E6A4910DF5834B8FE70E6BCFEEAC0352434196BDF4B2485D5A1,
                commitment=bytes.fromhex(
                    "8F59A8D2A1A625A17F3FEA0FE5EB8C896DB3764F3185481BC22F91B4AAFFCCA2"
                    "5F26936857BC3A7C2539EA8EC3A952B7"
                ),
                proof=bytes.fromhex(
                    "873033E038326E87ED3E1276FD140253FA08E9FC25FB2D9A98527FC22A2C9612"
                    "FBEAFDAD446CBC7BCDBDCD780AF2C16A"
                ),
            ),
            id="point_evaluation",
        ),
    ],
)
def test_point_evaluation(
    benchmark_test: BenchmarkTestFiller,
    fork: Fork,
    precompile_address: Address,
    calldata: bytes,
) -> None:
    """Benchmark POINT EVALUATION 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.POINT_EVALUATION,
        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.