Skip to content

test_modexp_variable_gas_cost()

Documentation for tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py::test_modexp_variable_gas_cost@21507778.

Generate fixtures for these test cases for Amsterdam with:

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

Test ModExp variable gas cost.

Source code in tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
@pytest.mark.parametrize(
    "modexp_input,modexp_expected,gas_usage",
    create_modexp_variable_gas_test_cases(),
)
@EIPChecklist.Precompile.Test.InputLengths.Zero()
@EIPChecklist.GasCostChanges.Test.GasUpdatesMeasurement()
@pytest.mark.valid_from("Berlin")
@pytest.mark.eels_base_coverage
def test_modexp_variable_gas_cost(
    state_test: StateTestFiller,
    precompile_gas: int,
    gas_usage: int,
    pre: Alloc,
    tx: Transaction,
    fork: Fork,
    post: Dict,
) -> None:
    """Test ModExp variable gas cost."""
    if fork >= Osaka:  # Check that gas used defined in table is accurate
        assert (gas_usage is None) or (precompile_gas >= gas_usage), (
            "inconsistent gas usage"
        )
    state_test(pre=pre, tx=tx, post=post)

Parametrized Test Cases

This test generates 56 parametrized test cases across 8 forks.