Skip to content

test_invalid()

Documentation for tests/osaka/eip7951_p256verify_precompiles/test_eip_mainnet.py::test_invalid@7b8124a7.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7951_p256verify_precompiles/test_eip_mainnet.py::test_invalid --fork Osaka

Negative mainnet test for the P256VERIFY precompile.

The signature actually is a valid secp256k1 signature, so this is an interesting test case.

Source code in tests/osaka/eip7951_p256verify_precompiles/test_eip_mainnet.py
51
52
53
54
55
56
57
58
59
60
61
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
@pytest.mark.parametrize(
    "expected_output", [Spec.INVALID_RETURN_VALUE], ids=[""]
)
@pytest.mark.parametrize(
    "input_data",
    [
        pytest.param(
            H(  # 'hello world' k1 signed (with eth prefix) with private key 0xd946578401d1980aba1fc85df2a1ddc0d2d618aadd37b213f7f7f91a553b1499  # noqa: E501
                0xD9EBA16ED0ECAE432B71FE008C98CC872BB4CC214D3220A36F365326CF807D68
            )
            + R(
                0x69CCCD84CA870C08D49D596342F464017F2A05B0BE539682EAA7529E4BE2DE36
            )
            + S(
                0x2CDB85FE13CB7DE39C1C7385BE9F38E8BDE9963CCBECD96281C4DF3ACA38F537
            )
            + X(
                0x82AE98A95AE76E389354F0EC660CF071309EA2D2CB14ADB6543106B790BE27FD
            )
            + Y(
                0x77B2CDC82C3AA8F2CF21E6257C197D75F84DCD0BC2FF8875C3E245C0E0874751
            ),
            id="invalid_r1_sig_but_valid_k1_sig",
        ),
    ],
)
@pytest.mark.parametrize("precompile_address", [Spec.P256VERIFY], ids=[""])
def test_invalid(
    state_test: StateTestFiller, pre: Alloc, post: dict, tx: Transaction
) -> None:
    """
    Negative mainnet test for the P256VERIFY precompile.

    The signature actually is a valid secp256k1 signature,
    so this is an interesting test case.
    """
    state_test(pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 1 parametrized test case across 1 fork.