Skip to content

test_call_types()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2msm.py::test_call_types@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

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

Test the BLS12_G2MSM precompile using different call types.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_g2msm.py
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
@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 + Scalar(0),
            Spec.INF_G2,
            id="single_inf_times_zero",
        ),
        pytest.param(
            Spec.G2 + Scalar(0) + Spec.INF_G2 + Scalar(0),
            Spec.INF_G2,
            id="msm_all_zeros_different_call_types",
        ),
    ],
)
@pytest.mark.eels_base_coverage
def test_call_types(
    state_test: StateTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """Test the BLS12_G2MSM 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.