Skip to content

Commit

Permalink
fix: changes to api (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
amosStarkware authored Apr 16, 2024
1 parent d145432 commit 327416b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion crates/committer/src/patricia_merkle_tree/filled_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@ use crate::patricia_merkle_tree::errors::FilledTreeError;
use crate::patricia_merkle_tree::filled_node::FilledNode;
use crate::patricia_merkle_tree::types::{LeafDataTrait, NodeIndex};
use crate::storage::storage_trait::Storage;
use crate::storage::storage_trait::StorageKey;

/// Consider a Patricia-Merkle Tree which has been updated with new leaves.
/// FilledTree consists of all nodes which were modified in the update, including their updated
/// data and hashes.
pub(crate) trait FilledTree<L: LeafDataTrait> {
/// Serializes the tree into storage. Returns hash set of keys of the serialized nodes,
/// if successful.
fn serialize(&self, storage: impl Storage) -> Result<HashSet<&[u8]>, FilledTreeError>;
fn serialize(&self, storage: &mut impl Storage)
-> Result<HashSet<StorageKey>, FilledTreeError>;
}

pub(crate) struct FilledTreeImpl<L: LeafDataTrait> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ pub(crate) type OriginalSkeletonTreeResult<T> = Result<T, OriginalSkeletonTreeEr
/// nodes on the Merkle paths from the updated leaves to the root.
pub(crate) trait OriginalSkeletonTree<L: LeafDataTrait> {
fn compute_original_skeleton_tree(
storage: impl Storage,
leaf_indices: &[NodeIndex],
storage: &impl Storage,
leaf_indices: [NodeIndex],
root_hash: HashOutput,
tree_height: TreeHeight,
) -> OriginalSkeletonTreeResult<Box<Self>>;
) -> OriginalSkeletonTreeResult<impl OriginalSkeletonTree<L>>;

/// Computes and returns updated skeleton tree.
fn compute_updated_skeleton_tree(
Expand Down

0 comments on commit 327416b

Please sign in to comment.