Skip to content

test_invalid_gas_pairing()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_invalid_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_invalid_gas_pairing --fork Amsterdam

Test the BLS12_PAIRING precompile, by expecting the call to fail for all possible input lengths (up to k == PAIRINGS_TO_TEST) because the appropriate amount of gas is not provided.

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

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
@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(-1, id="insufficient_gas")]
)
@pytest.mark.parametrize("expected_output", [Spec.INVALID], ids=[""])
@pytest.mark.parametrize("precompile_address", [Spec.PAIRING])
def test_invalid_gas_pairing(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """
    Test the BLS12_PAIRING precompile, by expecting the call to fail for all
    possible input lengths (up to k == PAIRINGS_TO_TEST) because the
    appropriate amount of gas is not provided.

    If any of the calls succeeds, 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.