Skip to content

test_valid_gas_pairing()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_valid_gas_pairing@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_valid_gas_pairing --fork Amsterdam

Test the BLS12_PAIRING precompile, by expecting the call to succeed for all possible input lengths (up to k == PAIRINGS_TO_TEST).

If any of the calls fails, the test will fail.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
@pytest.mark.parametrize_by_fork(
    "precompile_gas_list,precompile_data_length_list",
    get_split_discount_table_by_fork(
        PAIRING_GAS, PAIRINGS_TO_TEST, Spec.LEN_PER_PAIR
    ),
)
@pytest.mark.parametrize("gas_modifier", [pytest.param(0, id="exact_gas")])
@pytest.mark.parametrize("expected_output", [Spec.PAIRING_TRUE], ids=[""])
@pytest.mark.parametrize("precompile_address", [Spec.PAIRING])
@pytest.mark.slow()
def test_valid_gas_pairing(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """
    Test the BLS12_PAIRING precompile, by expecting the call to succeed for all
    possible input lengths (up to k == PAIRINGS_TO_TEST).

    If any of the calls fails, the test will fail.
    """
    state_test(
        env=env,
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.