From f8fdece3163baa3ba3948cf47bdeed84d60c8923 Mon Sep 17 00:00:00 2001 From: Tzahi Taub Date: Thu, 11 Apr 2024 12:43:35 +0300 Subject: [PATCH] chore: remove hash generic args from the different tree traits --- .../original_skeleton_tree.rs | 9 ++++----- .../updated_skeleton_tree.rs | 18 +++++++----------- 2 files changed, 11 insertions(+), 16 deletions(-) diff --git a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree.rs b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree.rs index 2a64953e..461e902f 100644 --- a/crates/committer/src/patricia_merkle_tree/original_skeleton_tree.rs +++ b/crates/committer/src/patricia_merkle_tree/original_skeleton_tree.rs @@ -1,8 +1,8 @@ use std::collections::HashMap; -use crate::hash::types::{HashFunction, HashOutput}; +use crate::hash::types::HashOutput; use crate::patricia_merkle_tree::errors::OriginalSkeletonTreeError; -use crate::patricia_merkle_tree::types::{LeafDataTrait, NodeIndex, TreeHashFunction, TreeHeight}; +use crate::patricia_merkle_tree::types::{LeafDataTrait, NodeIndex, TreeHeight}; use crate::patricia_merkle_tree::updated_skeleton_tree::UpdatedSkeletonTree; use crate::storage::storage_trait::Storage; @@ -13,8 +13,7 @@ pub(crate) type OriginalSkeletonTreeResult = Result> -{ +pub(crate) trait OriginalSkeletonTree { fn compute_original_skeleton_tree( storage: impl Storage, leaf_indices: &[NodeIndex], @@ -26,5 +25,5 @@ pub(crate) trait OriginalSkeletonTree, - ) -> OriginalSkeletonTreeResult>; + ) -> OriginalSkeletonTreeResult>; } diff --git a/crates/committer/src/patricia_merkle_tree/updated_skeleton_tree.rs b/crates/committer/src/patricia_merkle_tree/updated_skeleton_tree.rs index 0c9f862b..8d713061 100644 --- a/crates/committer/src/patricia_merkle_tree/updated_skeleton_tree.rs +++ b/crates/committer/src/patricia_merkle_tree/updated_skeleton_tree.rs @@ -10,25 +10,21 @@ use crate::patricia_merkle_tree::updated_skeleton_node::UpdatedSkeletonNode; /// This trait represents the structure of the subtree which was modified in the update. /// It also contains the hashes of the Sibling nodes on the Merkle paths from the updated leaves /// to the root. -pub(crate) trait UpdatedSkeletonTree> -{ +pub(crate) trait UpdatedSkeletonTree { /// Computes and returns the filled tree. - fn compute_filled_tree(&self) -> Result, UpdatedSkeletonTreeError>; + fn compute_filled_tree>( + &self, + ) -> Result, UpdatedSkeletonTreeError>; } #[allow(dead_code)] -struct UpdatedSkeletonTreeImpl> { +struct UpdatedSkeletonTreeImpl { skeleton_tree: HashMap>, - hash_function: H, - tree_hash_function: TH, } #[allow(dead_code)] -impl< - L: LeafDataTrait + std::clone::Clone + std::marker::Sync + std::marker::Send, - H: HashFunction + std::marker::Sync, - TH: TreeHashFunction + std::marker::Sync, - > UpdatedSkeletonTreeImpl +impl + UpdatedSkeletonTreeImpl { fn get_sk_tree(&self) -> &HashMap> { &self.skeleton_tree