Skip to content

test_precompile_before_fork()

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

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
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
@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 case is only parametrized by fork.

Test ID (Abbreviated) expected_output call_succeeds precompile_address input_data precompile_gas_modifier
...fork_PragueToOsakaAtTime15k-blockchain_test-P256VERIFY_valid_input_6900_gas True 256 bb5a52f42f9c9261ed4361f59422a1e3 0036e7c32b270c8807a419feca605023 2ba3a8be6b94d5ec80a6d9d1190a436e ffe50d85a1eee859b8cc6af9bd5c2e18 4cd60b855d442f5b3c7b11eb6c4e0ae7 525fe710fab9aa7c77a67f79e6fadd76 2927b10512bae3eddcfe467828128bad 2903269919f7086069c8c4df6c732838 c7787964eaac00e5921fb1498a60f460 6766b3d9685001558d1a974e7341513e 0
...fork_PragueToOsakaAtTime15k-blockchain_test-P256VERIFY_invalid_input True 256 bb5a52f42f9c9261ed4361f59422a1e3 0036e7c32b270c8807a419feca605023 2ba3a8be6b94d5ec80a6d9d1190a436e ffe50d85a1eee859b8cc6af9bd5c2e18 4cd60b855d442f5b3c7b11eb6c4e0ae7 525fe710fab9aa7c77a67f79e6fadd76 2927b10512bae3eddcfe467828128bad 2903269919f7086069c8c4df6c732838 2927b10512bae3eddcfe467828128bad 2903269919f7086069c8c4df6c732838 0
...fork_PragueToOsakaAtTime15k-blockchain_test-P256VERIFY_valid_input_zero_gas True 256 bb5a52f42f9c9261ed4361f59422a1e3 0036e7c32b270c8807a419feca605023 2ba3a8be6b94d5ec80a6d9d1190a436e ffe50d85a1eee859b8cc6af9bd5c2e18 4cd60b855d442f5b3c7b11eb6c4e0ae7 525fe710fab9aa7c77a67f79e6fadd76 2927b10512bae3eddcfe467828128bad 2903269919f7086069c8c4df6c732838 c7787964eaac00e5921fb1498a60f460 6766b3d9685001558d1a974e7341513e -6900