Skip to content

test_call_types()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1mul.py::test_call_types@20373115.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1mul.py::test_call_types --fork Amsterdam

Test the BLS12_G1MUL precompile using different call types.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g1mul.py
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
@pytest.mark.parametrize(
    "call_opcode",  # Note `Op.CALL` is used for all the `test_valid` cases.
    [
        Op.STATICCALL,
        Op.DELEGATECALL,
        Op.CALLCODE,
    ],
)
@pytest.mark.parametrize(
    "input_data,expected_output",
    [
        pytest.param(
            Spec.INF_G1 + Scalar(0),
            Spec.INF_G1,
            id="zero_times_inf",
        ),
        pytest.param(
            Spec.INF_G1 + Scalar(2),
            Spec.INF_G1,
            id="two_times_inf",
        ),
    ],
)
@pytest.mark.eels_base_coverage
def test_call_types(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """Test the BLS12_G1MUL precompile using different call types."""
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 6 parametrized test cases across 3 forks.