Skip to content

test_modexp_invalid_inputs()

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

Generate fixtures for these test cases for Amsterdam with:

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

Test ModExp gas cost with invalid inputs.

Source code in tests/osaka/eip7883_modexp_gas_increase/test_modexp_thresholds.py
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
@pytest.mark.parametrize(
    "modexp_input,",
    [
        # These invalid inputs are from EIP-7823. Ref:
        # https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7823.md#analysis
        pytest.param(
            bytes.fromhex("9e5faafc"),
            id="invalid-case-1",
        ),
        pytest.param(
            bytes.fromhex("85474728"),
            id="invalid-case-2",
        ),
        pytest.param(
            bytes.fromhex("9e281a98" + "00" * 54 + "021e19e0c9bab2400000"),
            id="invalid-case-3",
        ),
    ],
)
@pytest.mark.parametrize(
    "modexp_expected,call_succeeds",
    [
        pytest.param(bytes(), False),
    ],
    ids=[""],
)
@EIPChecklist.Precompile.Test.Inputs.AllZeros
@pytest.mark.valid_from("Berlin")
def test_modexp_invalid_inputs(
    state_test: StateTestFiller,
    pre: Alloc,
    tx: Transaction,
    post: Dict,
) -> None:
    """Test ModExp gas cost with invalid inputs."""
    state_test(
        pre=pre,
        tx=tx,
        post=post,
    )

Parametrized Test Cases

This test generates 3 parametrized test cases across 8 forks.