Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: changes to api #44

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading