Skip to content

test_eip_2537()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_eip_mainnet.py::test_eip_2537@20373115.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_eip_mainnet.py::test_eip_2537 --fork Prague

Test the all precompiles of EIP-2537.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_eip_mainnet.py
17
18
19
20
21
22
23
24
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@pytest.mark.parametrize(
    "precompile_address,input_data,expected_output,vector_gas_value",
    [
        pytest.param(
            Spec.G1ADD,
            Spec.G1 + Spec.INF_G1,
            Spec.G1,
            None,
            id="G1ADD",
        ),
        pytest.param(
            Spec.G1MSM,
            Spec.G1 + Scalar(1) + Spec.INF_G1 + Scalar(1),
            Spec.G1,
            None,
            id="G1MSM",
        ),
        pytest.param(
            Spec.G2ADD,
            Spec.G2 + Spec.INF_G2,
            Spec.G2,
            None,
            id="G2ADD",
        ),
        pytest.param(
            Spec.G2MSM,
            Spec.G2 + Scalar(1) + Spec.INF_G2 + Scalar(1),
            Spec.G2,
            None,
            id="G2MSM",
        ),
        pytest.param(
            Spec.PAIRING,
            Spec.G1 + Spec.INF_G2,
            Spec.PAIRING_TRUE,
            None,
            id="PAIRING",
        ),
        pytest.param(
            Spec.MAP_FP_TO_G1,
            FP(
                799950832265136997107648781861994410980648980263584507133499364313075404851459407870655748616451882783569609925573  # noqa: E501
            ),
            Spec.INF_G1,
            None,
            id="fp_map_to_inf",
        ),
        pytest.param(
            Spec.MAP_FP2_TO_G2,
            FP2(
                (
                    3510328712861478240121438855244276237335901234329585006107499559909114695366216070652508985150831181717984778988906,  # noqa: E501
                    2924545590598115509050131525615277284817672420174395176262156166974132393611647670391999011900253695923948997972401,  # noqa: E501
                )
            ),
            Spec.INF_G2,
            None,
            id="fp_map_to_inf",
        ),
    ],
)
@pytest.mark.eels_base_coverage
def test_eip_2537(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """Test the all precompiles of EIP-2537."""
    state_test(
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 7 parametrized test cases across 1 fork.