@@ -7,7 +7,7 @@ use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
7
7
use ark_std:: borrow:: Borrow ;
8
8
use ark_std:: hash:: Hash ;
9
9
use ark_std:: vec:: Vec ;
10
- use ark_std :: collections:: { BTreeSet , HashMap } ;
10
+ use std :: collections:: { BTreeSet , HashMap } ;
11
11
12
12
#[ cfg( test) ]
13
13
mod tests;
@@ -107,9 +107,8 @@ pub type LeafParam<P> = <<P as Config>::LeafHash as CRHScheme>::Parameters;
107
107
/// [I] J
108
108
/// ```
109
109
/// Suppose we want to prove I, then `leaf_sibling_hash` is J, `auth_path` is `[C,D]`
110
- #[ derive( Derivative , CanonicalSerialize , CanonicalDeserialize ) ]
110
+ #[ derive( PartialEq , Derivative , CanonicalSerialize , CanonicalDeserialize ) ]
111
111
#[ derivative(
112
- PartialEq ( bound = "P: Config" ) ,
113
112
Clone ( bound = "P: Config" ) ,
114
113
Debug ( bound = "P: Config" ) ,
115
114
Default ( bound = "P: Config" )
@@ -270,9 +269,9 @@ impl<P: Config> MultiPath<P> {
270
269
271
270
Ok ( MultiPath {
272
271
leaf_indexes : indexes,
273
- auth_paths_prefix_lenghts : auth_paths_prefix_lenghts ,
274
- auth_paths_suffixes : auth_paths_suffixes ,
275
- leaf_siblings_hashes : leaf_siblings_hashes ,
272
+ auth_paths_prefix_lenghts,
273
+ auth_paths_suffixes,
274
+ leaf_siblings_hashes,
276
275
} )
277
276
}
278
277
@@ -309,20 +308,20 @@ impl<P: Config> MultiPath<P> {
309
308
) -> Result < bool , crate :: Error > {
310
309
// array of auth paths as arrays of InnerDigests
311
310
312
- let mut leaves = leaves. into_iter ( ) ;
311
+ let leaves: Vec < L > = leaves. into_iter ( ) . collect ( ) ;
313
312
314
- let mut auth_paths: Vec < Vec < P :: InnerDigest > > = self . decompress ( ) ?. peekable ( ) ;
313
+ let auth_paths: Vec < Vec < P :: InnerDigest > > = self . decompress ( ) ?. collect ( ) ;
315
314
316
- let tree_height = auth_paths. peek ( ) . unwrap ( ) . len ( ) + 2 ;
315
+ let tree_height = auth_paths[ 0 ] . len ( ) + 2 ;
317
316
318
317
// LookUp table to speedup computation avoid redundant hash computations
319
318
let mut hash_lut: HashMap < usize , P :: InnerDigest > = HashMap :: new ( ) ;
320
319
321
320
for i in 0 ..self . leaf_indexes . len ( ) {
322
321
let leaf_index = self . leaf_indexes [ i] ;
323
- let leaf = leaves. next ( ) . unwrap ( ) ;
322
+ let leaf = & leaves[ i ] ;
324
323
let leaf_sibling_hash = & self . leaf_siblings_hashes [ i] ;
325
- let auth_path = auth_paths. next ( ) . unwrap ( ) ;
324
+ let auth_path = & auth_paths[ i ] ;
326
325
327
326
let claimed_leaf_hash = P :: LeafHash :: evaluate ( & leaf_hash_params, leaf. clone ( ) ) ?;
328
327
let ( left_child, right_child) =
0 commit comments