@@ -89,6 +89,50 @@ def test_wycheproof_extra(state_test: StateTestFiller, pre: Alloc, post: dict, t
8989 state_test (env = Environment (), pre = pre , post = post , tx = tx )
9090
9191
92+ @pytest .mark .parametrize (
93+ "input_data" ,
94+ [
95+ pytest .param (
96+ H (0 ) + R (Spec .Gx ) + S (Spec .Gx ) + X (Spec .Gx ) + Y (Spec .Gy ),
97+ id = "hash_0" ,
98+ ),
99+ pytest .param (
100+ H (Spec .N - 1 ) + R (Spec .Gx ) + S (Spec .Gx - 1 ) + X (Spec .Gx ) + Y (Spec .Gy ),
101+ id = "hash_N_minus_1" ,
102+ ),
103+ pytest .param (
104+ H (Spec .N ) + R (Spec .Gx ) + S (Spec .Gx ) + X (Spec .Gx ) + Y (Spec .Gy ),
105+ id = "hash_N" ,
106+ ),
107+ pytest .param (
108+ H (Spec .P - 1 )
109+ + R (Spec .Gx )
110+ + S (Spec .Gx + Spec .P - 1 - Spec .N )
111+ + X (Spec .Gx )
112+ + Y (Spec .Gy ),
113+ id = "hash_P_minus_1" ,
114+ ),
115+ pytest .param (
116+ H (Spec .P ) + R (Spec .Gx ) + S (Spec .Gx + Spec .P - Spec .N ) + X (Spec .Gx ) + Y (Spec .Gy ),
117+ id = "hash_P" ,
118+ ),
119+ pytest .param (
120+ H (2 ** 256 - 1 )
121+ + R (Spec .Gx )
122+ + S (Spec .Gx + 2 ** 256 - 1 - Spec .N )
123+ + X (Spec .Gx )
124+ + Y (Spec .Gy ),
125+ id = "hash_max" ,
126+ ),
127+ ],
128+ )
129+ @pytest .mark .parametrize ("expected_output" , [Spec .SUCCESS_RETURN_VALUE ], ids = ["" ])
130+ @pytest .mark .parametrize ("precompile_address" , [Spec .P256VERIFY ], ids = ["" ])
131+ def test_valid (state_test : StateTestFiller , pre : Alloc , post : dict , tx : Transaction ):
132+ """Positive tests for the P256VERIFY precompile."""
133+ state_test (env = Environment (), pre = pre , post = post , tx = tx )
134+
135+
92136@pytest .mark .parametrize (
93137 "input_data" ,
94138 [
@@ -105,6 +149,30 @@ def test_wycheproof_extra(state_test: StateTestFiller, pre: Alloc, post: dict, t
105149 H (0 ) + R (0 ) + S (0 ) + X (0 ) + Y (0 ),
106150 id = "input_all_zeros" ,
107151 ),
152+ pytest .param (
153+ H (0 ) + Spec .R0 + Spec .S0 + Spec .X0 + Spec .Y0 ,
154+ id = "hash_0" ,
155+ ),
156+ pytest .param (
157+ H (Spec .N - 1 ) + Spec .R0 + Spec .S0 + Spec .X0 + Spec .Y0 ,
158+ id = "hash_N_minus_1" ,
159+ ),
160+ pytest .param (
161+ H (Spec .N ) + Spec .R0 + Spec .S0 + Spec .X0 + Spec .Y0 ,
162+ id = "hash_N" ,
163+ ),
164+ pytest .param (
165+ H (Spec .P - 1 ) + Spec .R0 + Spec .S0 + Spec .X0 + Spec .Y0 ,
166+ id = "hash_P_minus_1" ,
167+ ),
168+ pytest .param (
169+ H (Spec .P ) + Spec .R0 + Spec .S0 + Spec .X0 + Spec .Y0 ,
170+ id = "hash_P" ,
171+ ),
172+ pytest .param (
173+ H (2 ** 256 - 1 ) + Spec .R0 + Spec .S0 + Spec .X0 + Spec .Y0 ,
174+ id = "hash_max" ,
175+ ),
108176 pytest .param (
109177 Spec .H0 + R (0 ) + Spec .S0 + Spec .X0 + Spec .Y0 ,
110178 id = "r_eq_to_zero" ,
0 commit comments