Skip to content

test_precompile_before_fork()

Documentation for tests/osaka/eip7951_p256verify_precompiles/test_p256verify_before_fork.py::test_precompile_before_fork@20373115.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7951_p256verify_precompiles/test_p256verify_before_fork.py::test_precompile_before_fork --fork Osaka

Test P256VERIFY precompiles before the Osaka hard fork is active.

The call must succeed but the output must be empty.

Source code in tests/osaka/eip7951_p256verify_precompiles/test_p256verify_before_fork.py
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 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
@pytest.mark.parametrize(
    "precompile_address,input_data,precompile_gas_modifier",
    [
        pytest.param(
            Spec.P256VERIFY,
            Spec.H0 + Spec.R0 + Spec.S0 + Spec.X0 + Spec.Y0,
            0,
            id="P256VERIFY_valid_input_6900_gas",
        ),
        pytest.param(
            Spec.P256VERIFY,
            Spec.H0 + Spec.R0 + Spec.S0 + Spec.X0 + Spec.X0,
            0,
            id="P256VERIFY_invalid_input",
        ),
        pytest.param(
            Spec.P256VERIFY,
            Spec.H0 + Spec.R0 + Spec.S0 + Spec.X0 + Spec.Y0,
            -6900,
            id="P256VERIFY_valid_input_zero_gas",
        ),
    ],
)
@pytest.mark.parametrize(
    "expected_output,call_succeeds",
    [pytest.param(Spec.INVALID_RETURN_VALUE, True, id=pytest.HIDDEN_PARAM)],
)
@EIPChecklist.Precompile.Test.ForkTransition.Before.InvalidInput()
@EIPChecklist.Precompile.Test.ForkTransition.Before.ZeroGas()
def test_precompile_before_fork(
    blockchain_test: BlockchainTestFiller,
    pre: Alloc,
    post: dict,
    tx: Transaction,
) -> None:
    """
    Test P256VERIFY precompiles before the Osaka hard fork is active.

    The call must succeed but the output must be empty.
    """
    blockchain_test(
        pre=pre,
        blocks=[Block(txs=[tx])],
        post=post,
    )

Parametrized Test Cases

This test generates 3 parametrized test cases across 1 fork.