@@ -38,12 +38,12 @@ pub(crate) fn count_signers(topology: &AggregationTopology, overlap: usize) -> u
3838 topology. raw_xmss + child_count - overlap * n_overlaps
3939}
4040
41- pub fn hash_pubkeys ( pub_keys : & [ Digest ] ) -> Digest {
41+ pub fn hash_pubkeys ( pub_keys : & [ XmssPublicKey ] ) -> Digest {
4242 let iv = [ F :: ZERO ; DIGEST_LEN ] ;
4343 let flat: Vec < F > = iv
4444 . iter ( )
4545 . copied ( )
46- . chain ( pub_keys. iter ( ) . flat_map ( |pk| pk. 0 . iter ( ) . copied ( ) ) )
46+ . chain ( pub_keys. iter ( ) . flat_map ( |pk| pk. merkle_root . iter ( ) . copied ( ) ) )
4747 . collect ( ) ;
4848 Digest ( poseidon_compress_slice ( & flat) )
4949}
@@ -95,16 +95,16 @@ fn encode_xmss_signature(sig: &XmssSignature) -> Vec<F> {
9595}
9696
9797#[ derive( Debug , Serialize , Deserialize ) ]
98- pub struct AggregatedSigs {
99- pub pub_keys : Vec < Digest > ,
98+ pub struct AggregatedXMSS {
99+ pub pub_keys : Vec < XmssPublicKey > ,
100100 pub proof : PrunedProof < F > ,
101101 pub bytecode_point : Option < MultilinearPoint < EF > > ,
102102 // benchmark / debug purpose
103103 #[ serde( skip, default ) ]
104104 pub metadata : Option < ExecutionMetadata > ,
105105}
106106
107- impl AggregatedSigs {
107+ impl AggregatedXMSS {
108108 pub fn raw_proof ( & self ) -> Option < RawProof < F > > {
109109 self . proof . clone ( ) . restore ( ) . map ( |p| p. into_raw_proof ( ) )
110110 }
@@ -152,31 +152,31 @@ impl AggregatedSigs {
152152}
153153
154154pub fn verify_aggregation (
155- sigs : & AggregatedSigs ,
155+ agg_sig : & AggregatedXMSS ,
156156 message : & [ F ; MESSAGE_LEN_FE ] ,
157157 slot : u32 ,
158158) -> Result < ProofVerificationDetails , ProofError > {
159- if !sigs . pub_keys . is_sorted ( ) {
159+ if !agg_sig . pub_keys . is_sorted ( ) {
160160 return Err ( ProofError :: InvalidProof ) ;
161161 }
162- let public_input = sigs . public_input ( message, slot) ;
162+ let public_input = agg_sig . public_input ( message, slot) ;
163163 let bytecode = get_aggregation_bytecode ( ) ;
164164 verify_execution (
165165 bytecode,
166166 & public_input,
167- sigs . raw_proof ( ) . ok_or ( ProofError :: InvalidProof ) ?,
167+ agg_sig . raw_proof ( ) . ok_or ( ProofError :: InvalidProof ) ?,
168168 )
169169}
170170
171171/// panics if one of the sub-proof (children) is invalid
172172#[ instrument( skip_all) ]
173173pub fn aggregate (
174- children : & [ AggregatedSigs ] ,
174+ children : & [ AggregatedXMSS ] ,
175175 mut raw_xmss : Vec < ( XmssPublicKey , XmssSignature ) > ,
176176 message : & [ F ; MESSAGE_LEN_FE ] ,
177177 slot : u32 ,
178178 log_inv_rate : usize ,
179- ) -> AggregatedSigs {
179+ ) -> AggregatedXMSS {
180180 raw_xmss. sort_by_key ( |( a, _) | Digest ( a. merkle_root ) ) ;
181181 raw_xmss. dedup_by ( |( a, _) , ( b, _) | a. merkle_root == b. merkle_root ) ;
182182
@@ -189,7 +189,7 @@ pub fn aggregate(
189189 let bytecode_claim_size = ( bytecode_point_n_vars + 1 ) * DIMENSION ;
190190
191191 // Build global_pub_keys as sorted deduplicated union
192- let mut global_pub_keys: Vec < Digest > = raw_xmss. iter ( ) . map ( |( pk, _) | Digest ( pk. merkle_root ) ) . collect ( ) ;
192+ let mut global_pub_keys: Vec < XmssPublicKey > = raw_xmss. iter ( ) . map ( |( pk, _) | pk. clone ( ) ) . collect ( ) ;
193193 for child in children. iter ( ) {
194194 assert ! ( child. pub_keys. is_sorted( ) , "child pub_keys must be sorted" ) ;
195195 global_pub_keys. extend_from_slice ( & child. pub_keys ) ;
@@ -297,8 +297,8 @@ pub fn aggregate(
297297 let pubkeys_start = public_memory. len ( ) + header_size;
298298
299299 // Build source blocks (also discovers duplicate pub_keys)
300- let mut claimed: HashSet < Digest > = HashSet :: new ( ) ;
301- let mut dup_pub_keys: Vec < Digest > = Vec :: new ( ) ;
300+ let mut claimed: HashSet < XmssPublicKey > = HashSet :: new ( ) ;
301+ let mut dup_pub_keys: Vec < XmssPublicKey > = Vec :: new ( ) ;
302302 let mut source_blocks: Vec < Vec < F > > = vec ! [ ] ;
303303
304304 // Build XMSS signatures (one Vec<F> per signature, consumed by hint_xmss)
@@ -308,10 +308,9 @@ pub fn aggregate(
308308 {
309309 let mut block = vec ! [ F :: from_usize( raw_count) ] ;
310310 for ( pk, _) in & raw_xmss {
311- let key = Digest ( pk. merkle_root ) ;
312- let pos = global_pub_keys. binary_search ( & key) . unwrap ( ) ;
311+ let pos = global_pub_keys. binary_search ( pk) . unwrap ( ) ;
313312 block. push ( F :: from_usize ( pos) ) ;
314- claimed. insert ( key ) ;
313+ claimed. insert ( pk . clone ( ) ) ;
315314 }
316315 source_blocks. push ( block) ;
317316 }
@@ -320,12 +319,12 @@ pub fn aggregate(
320319 for ( i, child) in children. iter ( ) . enumerate ( ) {
321320 let mut block = vec ! [ F :: from_usize( child. pub_keys. len( ) ) ] ;
322321 for key in & child. pub_keys {
323- if claimed. insert ( * key) {
322+ if claimed. insert ( key. clone ( ) ) {
324323 let pos = global_pub_keys. binary_search ( key) . unwrap ( ) ;
325324 block. push ( F :: from_usize ( pos) ) ;
326325 } else {
327326 block. push ( F :: from_usize ( n_sigs + dup_pub_keys. len ( ) ) ) ;
328- dup_pub_keys. push ( * key) ;
327+ dup_pub_keys. push ( key. clone ( ) ) ;
329328 }
330329 }
331330
@@ -364,10 +363,10 @@ pub fn aggregate(
364363 assert_eq ! ( private_input. len( ) , header_size) ;
365364
366365 for pk in & global_pub_keys {
367- private_input. extend_from_slice ( & pk. 0 ) ;
366+ private_input. extend_from_slice ( & pk. merkle_root ) ;
368367 }
369368 for pk in & dup_pub_keys {
370- private_input. extend_from_slice ( & pk. 0 ) ;
369+ private_input. extend_from_slice ( & pk. merkle_root ) ;
371370 }
372371 for block in & source_blocks {
373372 private_input. extend_from_slice ( block) ;
@@ -397,7 +396,7 @@ pub fn aggregate(
397396 } ;
398397 let execution_proof = prove_execution ( bytecode, & non_reserved_public_input, & witness, & whir_config, false ) ;
399398
400- AggregatedSigs {
399+ AggregatedXMSS {
401400 pub_keys : global_pub_keys,
402401 proof : execution_proof. proof ,
403402 bytecode_point,
0 commit comments