Skip to content

test_modexp_gas_usage_contract_wrapper()

Documentation for tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py::test_modexp_gas_usage_contract_wrapper@892e6d1e.

Generate fixtures for these test cases for Amsterdam with:

fill -v tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py::test_modexp_gas_usage_contract_wrapper --fork Amsterdam

Test ModExp gas cost with different gas modifiers using contract wrapper calls.

Source code in tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
@pytest.mark.parametrize(
    "modexp_input,modexp_expected,precompile_gas_modifier,call_succeeds",
    [
        pytest.param(
            Spec.modexp_input,
            Spec.modexp_expected,
            1,
            True,
            id="extra_gas",
        ),
        pytest.param(
            Spec.modexp_input,
            Spec.modexp_expected,
            0,
            True,
            id="exact_gas",
        ),
        pytest.param(
            Spec.modexp_input,
            Spec.modexp_error,
            -1,
            False,
            id="insufficient_gas",
        ),
        pytest.param(
            Spec.modexp_input,
            Spec.modexp_expected,
            float("inf"),
            True,
            id="excessive_gas",
        ),
    ],
)
@EIPChecklist.Precompile.Test.GasUsage.Dynamic()
@EIPChecklist.Precompile.Test.ExcessiveGasUsage()
@pytest.mark.valid_from("Berlin")
def test_modexp_gas_usage_contract_wrapper(
    state_test: StateTestFiller,
    pre: Alloc,
    tx: Transaction,
    post: Dict,
) -> None:
    """
    Test ModExp gas cost with different gas modifiers using contract wrapper
    calls.
    """
    state_test(pre=pre, tx=tx, post=post)

Parametrized Test Cases

This test generates 4 parametrized test cases across 8 forks.