Skip to content

test_gas()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py::test_gas@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py::test_gas --fork Amsterdam

Test the BLS12_G1ADD precompile gas requirements.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1add.py
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
@pytest.mark.parametrize(
    "input_data,expected_output,precompile_gas_modifier",
    [
        pytest.param(
            Spec.INF_G1 + Spec.INF_G1,
            Spec.INF_G1,
            1,
            id="extra_gas",
        ),
        pytest.param(
            Spec.INF_G1 + Spec.INF_G1,
            Spec.INVALID,
            -1,
            id="insufficient_gas",
        ),
    ],
)
def test_gas(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """Test the BLS12_G1ADD precompile gas requirements."""
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 2 parametrized test cases across 3 forks.