Skip to content

test_invalid_multi_inf()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_pairing.py::test_invalid_multi_inf@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/prague/eip2537_bls_12_381_precompiles/test_bls12_pairing.py::test_invalid_multi_inf --fork Amsterdam

Test maximum input given the current environment gas limit for the BLS12_PAIRING precompile and an invalid tail.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_pairing.py
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
442
443
444
445
446
447
448
449
450
451
452
453
454
@pytest.mark.slow
@pytest.mark.parametrize("precompile_gas", [None], ids=[""])
@pytest.mark.parametrize("expected_output", [Spec.INVALID], ids=[""])
def test_invalid_multi_inf(
    state_test: StateTestFiller,
    pre: Alloc,
    call_contract_address: Address,
    sender: EOA,
    fork: Fork,
    post: dict,
) -> None:
    """
    Test maximum input given the current environment gas limit for the
    BLS12_PAIRING precompile and an invalid tail.
    """
    extra_gas = 100_000

    max_gas_limit = fork.transaction_gas_limit_cap() or Environment().gas_limit

    inf_data = Spec.INF_G1 + Spec.INF_G2
    invalid_data = PointG1(Spec.P, 0) + Spec.INF_G2

    gas_limit, input_data = binary_search(
        fork=fork,
        max_gas_limit=max_gas_limit,
        iteration_data=inf_data,
        suffix_data=invalid_data,
        extra_gas=extra_gas,
    )

    tx = Transaction(
        gas_limit=gas_limit,
        data=input_data,
        to=call_contract_address,
        sender=sender,
    )
    state_test(
        env=Environment(),
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 1 parametrized test case across 3 forks.