Skip to content

test_modexp_variable_gas_cost_exceed_tx_gas_cap()

Documentation for tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py::test_modexp_variable_gas_cost_exceed_tx_gas_cap@20373115.

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_exceed_tx_gas_cap --fork Amsterdam

Test ModExp variable gas cost. Inputs with an expected gas cost over the EIP-7825 tx gas cap.

Test case coverage table (gas cap): ┌─────┬──────┬─────┬──────┬───────┬─────────┬───────────────────────────────────────────────┐ │ ID │ Comp │ Rel │ Iter │ Clamp │ Gas │ Description │ ├─────┼──────┼─────┼──────┼───────┼─────────┼───────────────────────────────────────────────┤ │ Z16 │ L │ < │ C │ False │520060928│ Zero base, zero exp, large modulus (gas cap) | └─────┴──────┴─────┴──────┴───────┴─────────┴───────────────────────────────────────────────┘

Source code in tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
@pytest.mark.parametrize(
    "modexp_input,modexp_expected,expected_tx_cap_fail",
    [
        pytest.param(
            ModExpInput(
                base="00" * 32, exponent="00" * 1024, modulus="01" * 1024
            ),
            bytes.fromhex("00" * 1023 + "01"),
            True,
            id="Z16-gas-cap-test",
        ),
    ],
)
@pytest.mark.valid_from("Berlin")
def test_modexp_variable_gas_cost_exceed_tx_gas_cap(
    state_test: StateTestFiller, pre: Alloc, tx: Transaction, post: Dict
) -> None:
    """
    Test ModExp variable gas cost. Inputs with an expected gas cost over the
    EIP-7825 tx gas cap.

    Test case coverage table (gas cap):
    ┌─────┬──────┬─────┬──────┬───────┬─────────┬───────────────────────────────────────────────┐
    │ ID  │ Comp │ Rel │ Iter │ Clamp │   Gas   │ Description                                   │
    ├─────┼──────┼─────┼──────┼───────┼─────────┼───────────────────────────────────────────────┤
    │ Z16 │  L   │  <  │  C   │ False │520060928│ Zero base, zero exp, large modulus (gas cap)  |
    └─────┴──────┴─────┴──────┴───────┴─────────┴───────────────────────────────────────────────┘
    """  # noqa: W505, E501
    state_test(pre=pre, tx=tx, post=post)

Parametrized Test Cases

This test generates 1 parametrized test case across 8 forks.