11use std:: sync:: LazyLock ;
22
33use alloy:: primitives:: Keccak256 ;
4- use sp1_aggregation_program:: { ProofInput , SP1ProofInput } ;
4+ use sp1_aggregation_program:: { ProofVkAndPubInputs , SP1VkAndPubInputs } ;
55use sp1_sdk:: {
66 EnvProver , HashableKey , Prover , ProverClient , SP1ProofWithPublicValues , SP1Stdin ,
77 SP1VerifyingKey ,
@@ -22,9 +22,8 @@ pub struct SP1ProofWithPubValuesAndElf {
2222impl SP1ProofWithPubValuesAndElf {
2323 pub fn hash_vk_and_pub_inputs ( & self ) -> [ u8 ; 32 ] {
2424 let mut hasher = Keccak256 :: new ( ) ;
25- for & word in & self . vk ( ) . hash_u32 ( ) {
26- hasher. update ( word. to_le_bytes ( ) ) ;
27- }
25+ let vk_bytes = & self . vk ( ) . hash_bytes ( ) ;
26+ hasher. update ( vk_bytes) ;
2827 hasher. update ( self . proof_with_pub_values . public_values . as_slice ( ) ) ;
2928 hasher. finalize ( ) . into ( )
3029 }
@@ -45,15 +44,15 @@ pub(crate) fn aggregate_proofs(
4544 let mut stdin = SP1Stdin :: new ( ) ;
4645
4746 let mut program_input = sp1_aggregation_program:: Input {
48- proofs : vec ! [ ] ,
47+ proofs_vk_and_pub_inputs : vec ! [ ] ,
4948 merkle_root : input. merkle_root ,
5049 } ;
5150
5251 // write vk + public inputs
5352 for proof in input. proofs . iter ( ) {
5453 program_input
55- . proofs
56- . push ( ProofInput :: SP1Compressed ( SP1ProofInput {
54+ . proofs_vk_and_pub_inputs
55+ . push ( ProofVkAndPubInputs :: SP1Compressed ( SP1VkAndPubInputs {
5756 public_inputs : proof. proof_with_pub_values . public_values . to_vec ( ) ,
5857 vk : proof. vk ( ) . hash_u32 ( ) ,
5958 } ) ) ;
0 commit comments