Skip to content

test_valid_multi_inf()

Documentation for tests/prague/eip2537_bls_12_381_precompiles/test_bls12_pairing.py::test_valid_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_valid_multi_inf --fork Amsterdam

Test maximum input given the current environment gas limit for the BLS12_PAIRING precompile.

Source code in tests/prague/eip2537_bls_12_381_precompiles/test_bls12_pairing.py
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
@pytest.mark.slow
@pytest.mark.parametrize("precompile_gas", [None], ids=[""])
@pytest.mark.parametrize("expected_output", [Spec.PAIRING_TRUE], ids=[""])
def test_valid_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.
    """
    extra_gas = 100_000

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

    inf_data = Spec.INF_G1 + Spec.INF_G2

    gas_limit, input_data = binary_search(
        fork=fork,
        max_gas_limit=max_gas_limit,
        iteration_data=inf_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.