Skip to content

test_gas()

Documentation for tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py::test_gas@ffe48572.

Generate fixtures for these test cases for Bogota with:

fill -v tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py::test_gas --fork Bogota

Test P256Verify precompile gas requirements.

Source code in tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py
@pytest.mark.parametrize(
    "input_data,expected_output,precompile_gas_modifier,call_succeeds",
    [
        pytest.param(
            Spec.H0 + Spec.R0 + Spec.S0 + Spec.X0 + Spec.Y0,
            Spec.SUCCESS_RETURN_VALUE,
            1,
            True,
            id="extra_gas",
        ),
        pytest.param(
            Spec.H0 + Spec.R0 + Spec.S0 + Spec.X0 + Spec.Y0,
            Spec.INVALID_RETURN_VALUE,
            -1,
            False,
            id="insufficient_gas",
        ),
        pytest.param(
            Spec.H0 + Spec.R0 + Spec.S0 + Spec.X0 + Spec.Y0,
            Spec.INVALID_RETURN_VALUE,
            -6900,
            False,
            id="zero_gas",
        ),
        pytest.param(
            Spec.H0 + Spec.R0 + Spec.S0 + Spec.X0 + Spec.Y0,
            Spec.INVALID_RETURN_VALUE,
            -3450,
            False,
            id="3450_gas",
        ),
    ],
)
@pytest.mark.parametrize("precompile_address", [Spec.P256VERIFY], ids=[""])
@EIPChecklist.Precompile.Test.GasUsage.Constant.Exact()
@EIPChecklist.Precompile.Test.GasUsage.Constant.Oog()
def test_gas(
    state_test: StateTestFiller, pre: Alloc, post: dict, tx: Transaction
) -> None:
    """Test P256Verify precompile gas requirements."""
    state_test(env=Environment(), pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 4 parametrized test cases across 3 forks.