From a5f3dc62453e17ec1c2bbbf48c255cf48926774f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Tue, 30 Sep 2025 17:09:52 +0200 Subject: [PATCH] feat(tests): add more tests for P256 where R is at infinity Add more tests cases for the `p256verify` precompile where the final computed point `R` is at infinity by passing `Q = -G` and `u1 == u2`. Similar test cases exist in "wycheproof_extra". --- docs/CHANGELOG.md | 1 + .../eip7951_p256verify_precompiles/test_p256verify.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index aecab2d77f7..6dc6b1496d0 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -33,6 +33,7 @@ Test fixtures for use by clients are available for each release on the [Github r ### 🧪 Test Cases - ✨ Add an EIP-7928 test case targeting the `SELFDESTRUCT` opcode. ([#2159](https://github.com/ethereum/execution-spec-tests/pull/2159)). +- ✨ Add essential tests for coverage gaps in EIP-7951 (`p256verify` precompile) ([#2179](https://github.com/ethereum/execution-spec-tests/pull/2159), [#2203](https://github.com/ethereum/execution-spec-tests/pull/2203), [#2215](https://github.com/ethereum/execution-spec-tests/pull/2215), [#2216](https://github.com/ethereum/execution-spec-tests/pull/2216), [#2217](https://github.com/ethereum/execution-spec-tests/pull/2217), [#2218](https://github.com/ethereum/execution-spec-tests/pull/2218), [#2221](https://github.com/ethereum/execution-spec-tests/pull/2221), [#2229](https://github.com/ethereum/execution-spec-tests/pull/2229), [#2230](https://github.com/ethereum/execution-spec-tests/pull/2230), [#2237](https://github.com/ethereum/execution-spec-tests/pull/2237), [#2238](https://github.com/ethereum/execution-spec-tests/pull/2238)). ## [v5.0.0](https://github.com/ethereum/execution-spec-tests/releases/tag/v5.0.0) - 2025-09-05 diff --git a/tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py b/tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py index 51b2a80cb21..2ed35d86443 100644 --- a/tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py +++ b/tests/osaka/eip7951_p256verify_precompiles/test_p256verify.py @@ -334,6 +334,16 @@ def test_valid(state_test: StateTestFiller, pre: Alloc, post: dict, tx: Transact Spec.H0 + Spec.R0 + Spec.S0 + X(Spec.P + 1) + Spec.Y0, id="x_greater_than_p", ), + # Test case produces the point R at infinity: (R0/S0)*G + (R0/S0)*(-G). + pytest.param( + H(Spec.R0.value) + Spec.R0 + Spec.S0 + X(Spec.Gx) + Y(Spec.P - Spec.Gy), + id="R_at_infinity_v1", + ), + # Test case produces the point R at infinity: (1/1)*G + (1/1)*(-G). + pytest.param( + H(1) + R(1) + S(1) + X(Spec.Gx) + Y(Spec.P - Spec.Gy), + id="R_at_infinity_v2", + ), pytest.param( Spec.H0 + R(0x813EF79CCEFA9A56F7BA805F0E478584FE5F0DD5F567BC09B5123CCBC9832365)