Skip to content

test_call_types()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2add.py::test_call_types@21507778.

Generate fixtures for these test cases for Amsterdam with:

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

Test the BLS12_G2ADD precompile using different call types.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2add.py
504
505
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
538
539
@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_G2 + Spec.INF_G2,
            Spec.INF_G2,
            id="inf_plus_inf",
        ),
        pytest.param(
            Spec.INF_G2 + Spec.G2,
            Spec.G2,
            id="inf_plus_generator",
        ),
    ],
)
def test_call_types(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """Test the BLS12_G2ADD 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.