Skip to content

test_invalid_gas_g2msm()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py::test_invalid_gas_g2msm@20373115.

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_g2msm --fork Amsterdam

Test the BLS12_G2MSM discount gas table in full, by expecting the call to fail for all possible input lengths 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
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
@pytest.mark.parametrize_by_fork(
    "precompile_gas_list,precompile_data_length_list",
    get_split_discount_table_by_fork(
        G2_GAS, len(Spec.G2MSM_DISCOUNT_TABLE), G2_MSM_K_INPUT_LENGTH
    ),
)
@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.G2MSM])
@pytest.mark.eels_base_coverage
def test_invalid_gas_g2msm(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """
    Test the BLS12_G2MSM discount gas table in full, by expecting the call to
    fail for all possible input lengths 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 7 parametrized test cases across 3 forks.