Skip to content

test_isogeny_kernel_values()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp2_to_g2.py::test_isogeny_kernel_values@44293f1e.

Generate fixtures for these test cases for Prague with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp2_to_g2.py::test_isogeny_kernel_values --fork Prague

Test the BLS12_MAP_FP2_TO_G2 precompile with isogeny kernel values. Note this test only exists to align with the G1 test. G2_FIELD_POINTS_MAP_TO_IDENTITY is empty so there are no cases.

The isogeny kernel is simply the set of special field values, that after the two step mapping (first SWU onto an auxiliary curve, then a 3-degree isogeny back to G2), collapse exactly to the identity point.

For the G2 case the only kernel element is the point at infinity, and SWU never produces the identity point from a finite input t. Hence G2_FIELD_POINTS_MAP_TO_IDENTITY is empty. Please proceed to the generator in helpers.py for more details.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_map_fp2_to_g2.py
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
@pytest.mark.parametrize("expected_output", [Spec.INF_G2], ids=[""])
@pytest.mark.parametrize(
    "input_data,vector_gas_value",
    [
        pytest.param(t, None, id=f"isogeny_kernel_{i}")
        for i, t in enumerate(G2_FIELD_POINTS_MAP_TO_IDENTITY)
    ],
)
def test_isogeny_kernel_values(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
):
    """
    Test the BLS12_MAP_FP2_TO_G2 precompile with isogeny kernel values. Note this test only exists
    to align with the G1 test. `G2_FIELD_POINTS_MAP_TO_IDENTITY` is empty so there are no cases.

    The isogeny kernel is simply the set of special field values, that after the two step mapping
    (first SWU onto an auxiliary curve, then a 3-degree isogeny back to G2), collapse exactly
    to the identity point.

    For the G2 case the only kernel element is the point at infinity, and SWU never produces the
    identity point from a finite input t. Hence `G2_FIELD_POINTS_MAP_TO_IDENTITY` is empty. Please
    proceed to the generator in `helpers.py` for more details.
    """
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test case is only parametrized by fork and fixture format.

Test ID (Abbreviated) input_data vector_gas_value expected_output precompile_address
...fork_Prague-state_test-input_data_NotSetType.token-vector_gas_value_NotSetType.token-- NotSetType.token NotSetType.token PointG2(x=(0, 0), y=(0, 0)) 17
...fork_Prague-blockchain_test_from_state_test-input_data_NotSetType.token-vector_gas_value_NotSetType.token-- NotSetType.token NotSetType.token PointG2(x=(0, 0), y=(0, 0)) 17
...fork_Osaka-state_test-input_data_NotSetType.token-vector_gas_value_NotSetType.token-- NotSetType.token NotSetType.token PointG2(x=(0, 0), y=(0, 0)) 17
...fork_Osaka-blockchain_test_from_state_test-input_data_NotSetType.token-vector_gas_value_NotSetType.token-- NotSetType.token NotSetType.token PointG2(x=(0, 0), y=(0, 0)) 17