Skip to content

test_valid_gas_g1msm()

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

Test the BLS12_G1MSM discount gas table in full, by expecting the call to succeed for all possible input lengths because the appropriate amount of gas is provided.

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

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_variable_length_input_contracts.py
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
@pytest.mark.parametrize_by_fork(
    "precompile_gas_list,precompile_data_length_list",
    get_split_discount_table_by_fork(
        G1_GAS, len(Spec.G1MSM_DISCOUNT_TABLE), G1_MSM_K_INPUT_LENGTH
    ),
)
@pytest.mark.parametrize("gas_modifier", [pytest.param(0, id="exact_gas")])
@pytest.mark.parametrize("expected_output", [PointG1()], ids=[""])
@pytest.mark.parametrize("precompile_address", [Spec.G1MSM])
@pytest.mark.slow()
def test_valid_gas_g1msm(
    state_test: StateTestFiller,
    env: Environment,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """
    Test the BLS12_G1MSM discount gas table in full, by expecting the call to
    succeed for all possible input lengths because the appropriate amount of
    gas is provided.

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

Parametrized Test Cases

This test generates 4 parametrized test cases across 3 forks.