Skip to content

test_valid()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp_to_g1.py::test_valid@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp_to_g1.py::test_valid --fork Amsterdam

Test the BLS12_MAP_FP_TO_G1 precompile.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp_to_g1.py
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
@pytest.mark.parametrize(
    "input_data,expected_output,vector_gas_value",
    # Test vectors from the reference spec (from the cryptography team)
    vectors_from_file("map_fp_to_G1_bls.json")
    + [
        pytest.param(
            FP(0),
            G1_POINT_ZERO_FP,
            None,
            id="fp_0",
        ),
        pytest.param(
            FP(Spec.P - 1),
            PointG1(
                0x1073311196F8EF19477219CCEE3A48035FF432295AA9419EED45D186027D88B90832E14C4F0E2AA4D15F54D1C3ED0F93,
                0x16B3A3B2E3DDDF6A11459DDAF657FDE21C4F10282A56029D9B55AB3CE1F41E1CF39AD27E0EA35823C7D3250E81FF3D66,
            ),
            None,
            id="fp_p_minus_1",
        ),
        pytest.param(
            FP(
                799950832265136997107648781861994410980648980263584507133499364313075404851459407870655748616451882783569609925573
            ),
            Spec.INF_G1,
            None,
            id="fp_map_to_inf",
        ),
    ],
)
@pytest.mark.eels_base_coverage
def test_valid(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """Test the BLS12_MAP_FP_TO_G1 precompile."""
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 8 parametrized test cases across 3 forks.