Skip to content

test_wycheproof_valid()

Documentation for tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py::test_wycheproof_valid@7b8124a7.

Generate fixtures for these test cases for Osaka with:

fill -v tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py::test_wycheproof_valid --fork Osaka

Test P256Verify precompile with Wycheproof test suite (valid cases).

Source code in tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
@pytest.mark.parametrize(
    "input_data,expected_output,vector_gas_value",
    vectors_from_file("secp256r1_signature_specific.json")
    + vectors_from_file("secp256r1_shamir_multiplication.json")
    + vectors_from_file("secp256r1_special_case_hash.json")
    + vectors_from_file("secp256r1_u1_u2.json")
    + vectors_from_file("secp256r1_k_and_s.json")
    + vectors_from_file("secp256r1_public_key.json"),
    # Test vectors generated from Wycheproof's ECDSA secp256r1 SHA-256 test
    # suite, valid cases are from this source:
    # https://github.com/C2SP/wycheproof/blob/main/testvectors/ecdsa_secp256r1_sha256_test.json
)
@pytest.mark.parametrize("precompile_address", [Spec.P256VERIFY], ids=[""])
@EIPChecklist.Precompile.Test.CallContexts.Normal()
@EIPChecklist.Precompile.Test.Inputs.Valid()
@EIPChecklist.Precompile.Test.Inputs.MaxValues()
def test_wycheproof_valid(
    state_test: StateTestFiller, pre: Alloc, post: dict, tx: Transaction
) -> None:
    """Test P256Verify precompile with Wycheproof test suite (valid cases)."""
    state_test(env=Environment(), pre=pre, post=post, tx=tx)

Parametrized Test Cases

This test generates 180 parametrized test cases across 1 fork.