@@ -26,11 +26,10 @@ mod tests {
2626
2727 use crate :: merkle_tree:: MerkleBatchPath ;
2828 use crate :: {
29- AggregateSignature , AggregationError , BasicVerifier , Clerk , CoreVerifierError , Initializer ,
30- KeyRegistration , Parameters , Signer , SingleSignature , SingleSignatureWithRegisteredParty ,
31- Stake ,
29+ AggregateSignature , AggregateSignatureType , AggregationError , BasicVerifier , Clerk ,
30+ CoreVerifierError , Initializer , KeyRegistration , Parameters , Signer , SingleSignature ,
31+ SingleSignatureWithRegisteredParty , Stake , bls_multi_signature :: BlsVerificationKey ,
3232 } ;
33- use crate :: { AggregateSignatureType , bls_multi_signature:: BlsVerificationKey } ;
3433
3534 type Sig = AggregateSignature < D > ;
3635 type D = Blake2b < U32 > ;
@@ -459,36 +458,32 @@ mod tests {
459458 #[ test]
460459 fn test_invalid_proof_index_unique( tc in arb_proof_setup( 10 ) ) {
461460 with_proof_mod( tc, |aggr, clerk, _msg| {
462- if let AggregateSignature :: Concatenation ( concatenation_proof) = aggr {
463- for sig_reg in concatenation_proof. signatures. iter_mut( ) {
464- for index in sig_reg. sig. indexes. iter_mut( ) {
465- * index %= clerk. params. k - 1
466- }
461+ let mut concatenation_proof = AggregateSignature :: to_concatenation_proof( aggr) . unwrap( ) . to_owned( ) ;
462+ for sig_reg in concatenation_proof. signatures. iter_mut( ) {
463+ for index in sig_reg. sig. indexes. iter_mut( ) {
464+ * index %= clerk. params. k - 1
467465 }
468- } else{
469- panic!( "Unexpected aggregate signature type" ) ;
470466 }
467+ * aggr = AggregateSignature :: Concatenation ( concatenation_proof) ;
471468 } )
472469 }
473470 #[ test]
474471 fn test_invalid_proof_path( tc in arb_proof_setup( 10 ) ) {
475472 with_proof_mod( tc, |aggr, _, _msg| {
476- if let AggregateSignature :: Concatenation ( concatenation_proof) = aggr {
477- let p = concatenation_proof. batch_proof. clone( ) ;
478- let mut index_list = p. indices. clone( ) ;
479- let values = p. values;
480- let batch_proof = {
481- index_list[ 0 ] += 1 ;
482- MerkleBatchPath {
483- values,
484- indices: index_list,
485- hasher: Default :: default ( )
486- }
487- } ;
488- concatenation_proof. batch_proof = batch_proof;
489- } else{
490- panic!( "Unexpected aggregate signature type" ) ;
491- }
473+ let mut concatenation_proof = AggregateSignature :: to_concatenation_proof( aggr) . unwrap( ) . to_owned( ) ;
474+ let p = concatenation_proof. batch_proof. clone( ) ;
475+ let mut index_list = p. indices. clone( ) ;
476+ let values = p. values;
477+ let batch_proof = {
478+ index_list[ 0 ] += 1 ;
479+ MerkleBatchPath {
480+ values,
481+ indices: index_list,
482+ hasher: Default :: default ( )
483+ }
484+ } ;
485+ concatenation_proof. batch_proof = batch_proof;
486+ * aggr = AggregateSignature :: Concatenation ( concatenation_proof) ;
492487 } )
493488 }
494489 }
0 commit comments