34
34
from tests .cancun .eip4844_blobs .spec import Spec as BlobsSpec
35
35
from tests .istanbul .eip152_blake2 .common import Blake2bInput
36
36
from tests .istanbul .eip152_blake2 .spec import Spec as Blake2bSpec
37
+ from tests .osaka .eip7951_p256verify_precompiles import spec as p256verify_spec
38
+ from tests .osaka .eip7951_p256verify_precompiles .spec import FieldElement
37
39
from tests .prague .eip2537_bls_12_381_precompiles import spec as bls12381_spec
38
40
from tests .prague .eip2537_bls_12_381_precompiles .spec import BytesConcatenation
39
41
@@ -680,6 +682,17 @@ def test_worst_modexp(state_test: StateTestFiller, pre: Alloc, fork: Fork):
680
682
],
681
683
id = "bls12_fp_to_g2" ,
682
684
),
685
+ pytest .param (
686
+ p256verify_spec .Spec .P256VERIFY ,
687
+ [
688
+ p256verify_spec .Spec .H0 ,
689
+ p256verify_spec .Spec .R0 ,
690
+ p256verify_spec .Spec .S0 ,
691
+ p256verify_spec .Spec .X0 ,
692
+ p256verify_spec .Spec .Y0 ,
693
+ ],
694
+ id = "p256verify" ,
695
+ ),
683
696
],
684
697
)
685
698
@pytest .mark .slow ()
@@ -693,20 +706,23 @@ def test_worst_precompile_fixed_cost(
693
706
"""Test running a block filled with a precompile with fixed cost."""
694
707
env = Environment ()
695
708
709
+ if precompile_address not in fork .precompiles ():
710
+ pytest .skip ("Precompile not enabled" )
711
+
696
712
concatenated_bytes : bytes
697
713
if all (isinstance (p , str ) for p in parameters ):
698
714
parameters_str = cast (list [str ], parameters )
699
715
concatenated_hex_string = "" .join (parameters_str )
700
716
concatenated_bytes = bytes .fromhex (concatenated_hex_string )
701
- elif all (isinstance (p , (bytes , BytesConcatenation )) for p in parameters ):
717
+ elif all (isinstance (p , (bytes , BytesConcatenation , FieldElement )) for p in parameters ):
702
718
parameters_bytes_list = [
703
- bytes (p ) for p in cast (list [BytesConcatenation | bytes ], parameters )
719
+ bytes (p ) for p in cast (list [BytesConcatenation | bytes | FieldElement ], parameters )
704
720
]
705
721
concatenated_bytes = b"" .join (parameters_bytes_list )
706
722
else :
707
723
raise TypeError (
708
724
"parameters must be a list of strings (hex) "
709
- "or a list of byte-like objects (bytes or BytesConcatenation )."
725
+ "or a list of byte-like objects (bytes, BytesConcatenation or FieldElement )."
710
726
)
711
727
712
728
padding_length = (32 - (len (concatenated_bytes ) % 32 )) % 32
0 commit comments