diff --git a/mp2-v1/src/query/batching_planner.rs b/mp2-v1/src/query/batching_planner.rs index d0c21d029..0a280e136 100644 --- a/mp2-v1/src/query/batching_planner.rs +++ b/mp2-v1/src/query/batching_planner.rs @@ -10,6 +10,7 @@ use ryhope::{ storage::{updatetree::UpdateTree, WideLineage}, Epoch, }; +use serde::{Deserialize, Serialize}; use verifiable_db::query::{ api::{NodePath, RowInput, TreePathInputs}, computational_hash_ids::ColumnIDs, @@ -195,8 +196,10 @@ async fn generate_chunks( /// /// (2,0) (2,1) (2,2) (2,3) (2,4) /// ``` -#[derive(Clone, Debug, Hash, Eq, PartialEq, Default)] -pub struct UTKey((usize, usize)); +#[derive( + Clone, Copy, Debug, Default, PartialEq, PartialOrd, Ord, Eq, Hash, Serialize, Deserialize, +)] +pub struct UTKey(pub (usize, usize)); impl UTKey { /// Compute the key of the child node of `self` that has `num_left_siblings` @@ -318,15 +321,13 @@ impl ProvingTree { let num_childrens = parent_node.children_keys.len(); let new_child_key = parent_key.children_key(num_childrens); let child_node = ProvingTreeNode { - parent_key: Some(parent_key.clone()), + parent_key: Some(*parent_key), children_keys: vec![], }; // insert new child in the set of children of the parent - parent_node.children_keys.push(new_child_key.clone()); + parent_node.children_keys.push(new_child_key); assert!( - self.nodes - .insert(new_child_key.clone(), child_node) - .is_none(), + self.nodes.insert(new_child_key, child_node).is_none(), "Node with key {:?} already found in the tree", new_child_key ); @@ -339,7 +340,7 @@ impl ProvingTree { }; let root_key = UTKey((0, 0)); assert!( - self.nodes.insert(root_key.clone(), root).is_none(), + self.nodes.insert(root_key, root).is_none(), "Error: root node inserted multiple times" ); root_key @@ -412,7 +413,7 @@ impl ProvingTree { while node_key.is_some() { // place node key in the path let key = node_key.unwrap(); - path.push(key.clone()); + path.push(*key); // fetch key of the parent node, if any node_key = self .nodes @@ -449,7 +450,7 @@ impl UTForChunksBuilder { let path = tree.compute_path_for_leaf(node_index); ( ( - path.last().unwrap().clone(), // chunk node is always a leaf of the tree, so it is the last node + *path.last().unwrap(), // chunk node is always a leaf of the tree, so it is the last node // in the path chunk, ), diff --git a/mp2-v1/src/query/planner.rs b/mp2-v1/src/query/planner.rs index 54734abd4..c73e9039d 100644 --- a/mp2-v1/src/query/planner.rs +++ b/mp2-v1/src/query/planner.rs @@ -65,7 +65,7 @@ impl<'a, C: ContextProvider> NonExistenceInput<'a, C> { } } - pub(crate) async fn find_row_node_for_non_existence( + pub async fn find_row_node_for_non_existence( &self, primary: BlockPrimaryIndex, ) -> anyhow::Result { diff --git a/mp2-v1/tests/common/cases/query/aggregated_queries.rs b/mp2-v1/tests/common/cases/query/aggregated_queries.rs index 8aad454f1..cae029b4d 100644 --- a/mp2-v1/tests/common/cases/query/aggregated_queries.rs +++ b/mp2-v1/tests/common/cases/query/aggregated_queries.rs @@ -237,7 +237,7 @@ pub(crate) async fn prove_query( let proof_key = ProofKey::QueryAggregate(( planner.query.query.clone(), planner.query.placeholders.placeholder_values(), - k.clone(), + *k, )); planner.ctx.storage.store_proof(proof_key.clone(), proof)?; proof_id = Some(proof_key); diff --git a/verifiable-db/src/query/api.rs b/verifiable-db/src/query/api.rs index 18d5d7e0e..58e902a9b 100644 --- a/verifiable-db/src/query/api.rs +++ b/verifiable-db/src/query/api.rs @@ -119,7 +119,7 @@ impl NodePath { } } -#[derive(Clone, Debug)] +#[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] /// Data structure containing the inputs necessary to prove a query for a row /// of the DB table. pub struct RowInput {