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@e9958ed2.

Generate fixtures for these test cases for Osaka with:

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

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
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
@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 case is only parametrized by fork and fixture format.

Test ID (Abbreviated) precompile_gas_list precompile_data_length_list precompile_address expected_output gas_modifier
...fork_Prague-full_discount_table-state_test-precompile_address_15--exact_gas [70300, 102900, 135500, 168100, 200700, 233300, 265900, 298500, 331100, 363700, 396300, 428900, 461500, 494100, 526700, 559300, 591900, 624500, 657100, 689700] [384, 768, 1152, 1536, 1920, 2304, 2688, 3072, 3456, 3840, 4224, 4608, 4992, 5376, 5760, 6144, 6528, 6912, 7296, 7680] 15 00000000000000000000000000000000 00000000000000000000000000000001 0
...fork_Prague-full_discount_table-blockchain_test_from_state_test-precompile_address_15--exact_gas [70300, 102900, 135500, 168100, 200700, 233300, 265900, 298500, 331100, 363700, 396300, 428900, 461500, 494100, 526700, 559300, 591900, 624500, 657100, 689700] [384, 768, 1152, 1536, 1920, 2304, 2688, 3072, 3456, 3840, 4224, 4608, 4992, 5376, 5760, 6144, 6528, 6912, 7296, 7680] 15 00000000000000000000000000000000 00000000000000000000000000000001 0
...fork_Osaka-discount_table_1_of_1-state_test-precompile_address_15--exact_gas [70300, 102900, 135500, 168100, 200700, 233300, 265900, 298500, 331100, 363700, 396300, 428900, 461500, 494100, 526700, 559300, 591900, 624500, 657100, 689700] [384, 768, 1152, 1536, 1920, 2304, 2688, 3072, 3456, 3840, 4224, 4608, 4992, 5376, 5760, 6144, 6528, 6912, 7296, 7680] 15 00000000000000000000000000000000 00000000000000000000000000000001 0
...fork_Osaka-discount_table_1_of_1-blockchain_test_from_state_test-precompile_address_15--exact_gas [70300, 102900, 135500, 168100, 200700, 233300, 265900, 298500, 331100, 363700, 396300, 428900, 461500, 494100, 526700, 559300, 591900, 624500, 657100, 689700] [384, 768, 1152, 1536, 1920, 2304, 2688, 3072, 3456, 3840, 4224, 4608, 4992, 5376, 5760, 6144, 6528, 6912, 7296, 7680] 15 00000000000000000000000000000000 00000000000000000000000000000001 0