@@ -26,11 +26,10 @@ mod tests {
26
26
27
27
use crate :: merkle_tree:: MerkleBatchPath ;
28
28
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 ,
32
32
} ;
33
- use crate :: { AggregateSignatureType , bls_multi_signature:: BlsVerificationKey } ;
34
33
35
34
type Sig = AggregateSignature < D > ;
36
35
type D = Blake2b < U32 > ;
@@ -459,36 +458,32 @@ mod tests {
459
458
#[ test]
460
459
fn test_invalid_proof_index_unique( tc in arb_proof_setup( 10 ) ) {
461
460
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
467
465
}
468
- } else{
469
- panic!( "Unexpected aggregate signature type" ) ;
470
466
}
467
+ * aggr = AggregateSignature :: Concatenation ( concatenation_proof) ;
471
468
} )
472
469
}
473
470
#[ test]
474
471
fn test_invalid_proof_path( tc in arb_proof_setup( 10 ) ) {
475
472
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) ;
492
487
} )
493
488
}
494
489
}
0 commit comments