@@ -10,6 +10,7 @@ use ryhope::{
10
10
storage:: { updatetree:: UpdateTree , WideLineage } ,
11
11
Epoch ,
12
12
} ;
13
+ use serde:: { Deserialize , Serialize } ;
13
14
use verifiable_db:: query:: {
14
15
api:: { NodePath , RowInput , TreePathInputs } ,
15
16
computational_hash_ids:: ColumnIDs ,
@@ -195,8 +196,10 @@ async fn generate_chunks<const CHUNK_SIZE: usize, C: ContextProvider>(
195
196
///
196
197
/// (2,0) (2,1) (2,2) (2,3) (2,4)
197
198
/// ```
198
- #[ derive( Clone , Debug , Hash , Eq , PartialEq , Default ) ]
199
- pub struct UTKey < const ARITY : usize > ( ( usize , usize ) ) ;
199
+ #[ derive(
200
+ Clone , Copy , Debug , Default , PartialEq , PartialOrd , Ord , Eq , Hash , Serialize , Deserialize ,
201
+ ) ]
202
+ pub struct UTKey < const ARITY : usize > ( pub ( usize , usize ) ) ;
200
203
201
204
impl < const ARITY : usize > UTKey < ARITY > {
202
205
/// Compute the key of the child node of `self` that has `num_left_siblings`
@@ -318,15 +321,13 @@ impl<const ARITY: usize> ProvingTree<ARITY> {
318
321
let num_childrens = parent_node. children_keys . len ( ) ;
319
322
let new_child_key = parent_key. children_key ( num_childrens) ;
320
323
let child_node = ProvingTreeNode {
321
- parent_key : Some ( parent_key. clone ( ) ) ,
324
+ parent_key : Some ( * parent_key) ,
322
325
children_keys : vec ! [ ] ,
323
326
} ;
324
327
// insert new child in the set of children of the parent
325
- parent_node. children_keys . push ( new_child_key. clone ( ) ) ;
328
+ parent_node. children_keys . push ( new_child_key) ;
326
329
assert ! (
327
- self . nodes
328
- . insert( new_child_key. clone( ) , child_node)
329
- . is_none( ) ,
330
+ self . nodes. insert( new_child_key, child_node) . is_none( ) ,
330
331
"Node with key {:?} already found in the tree" ,
331
332
new_child_key
332
333
) ;
@@ -339,7 +340,7 @@ impl<const ARITY: usize> ProvingTree<ARITY> {
339
340
} ;
340
341
let root_key = UTKey ( ( 0 , 0 ) ) ;
341
342
assert ! (
342
- self . nodes. insert( root_key. clone ( ) , root) . is_none( ) ,
343
+ self . nodes. insert( root_key, root) . is_none( ) ,
343
344
"Error: root node inserted multiple times"
344
345
) ;
345
346
root_key
@@ -412,7 +413,7 @@ impl<const ARITY: usize> ProvingTree<ARITY> {
412
413
while node_key. is_some ( ) {
413
414
// place node key in the path
414
415
let key = node_key. unwrap ( ) ;
415
- path. push ( key. clone ( ) ) ;
416
+ path. push ( * key) ;
416
417
// fetch key of the parent node, if any
417
418
node_key = self
418
419
. nodes
@@ -449,7 +450,7 @@ impl<const NUM_CHUNKS: usize> UTForChunksBuilder<NUM_CHUNKS> {
449
450
let path = tree. compute_path_for_leaf ( node_index) ;
450
451
(
451
452
(
452
- path. last ( ) . unwrap ( ) . clone ( ) , // chunk node is always a leaf of the tree, so it is the last node
453
+ * path. last ( ) . unwrap ( ) , // chunk node is always a leaf of the tree, so it is the last node
453
454
// in the path
454
455
chunk,
455
456
) ,
0 commit comments