diff --git a/crates/committer/src/patricia_merkle_tree.rs b/crates/committer/src/patricia_merkle_tree.rs index 4339002e..1ccbf850 100644 --- a/crates/committer/src/patricia_merkle_tree.rs +++ b/crates/committer/src/patricia_merkle_tree.rs @@ -1,2 +1,2 @@ -pub mod patricia_merkle_node; -pub mod patricia_merkle_tree; +pub mod node; +pub mod tree; diff --git a/crates/committer/src/patricia_merkle_tree/node.rs b/crates/committer/src/patricia_merkle_tree/node.rs new file mode 100644 index 00000000..6b3ef9dd --- /dev/null +++ b/crates/committer/src/patricia_merkle_tree/node.rs @@ -0,0 +1 @@ +pub struct Node {} diff --git a/crates/committer/src/patricia_merkle_tree/patricia_merkle_node.rs b/crates/committer/src/patricia_merkle_tree/patricia_merkle_node.rs deleted file mode 100644 index dd039bc0..00000000 --- a/crates/committer/src/patricia_merkle_tree/patricia_merkle_node.rs +++ /dev/null @@ -1 +0,0 @@ -pub struct PatriciaMerkleNode {} diff --git a/crates/committer/src/patricia_merkle_tree/patricia_merkle_tree.rs b/crates/committer/src/patricia_merkle_tree/patricia_merkle_tree.rs deleted file mode 100644 index 5c5bdb7f..00000000 --- a/crates/committer/src/patricia_merkle_tree/patricia_merkle_tree.rs +++ /dev/null @@ -1,14 +0,0 @@ -use crate::patricia_merkle_tree::patricia_merkle_node::PatriciaMerkleNode; - -pub struct StarkFelt([u8; 32]); - -trait PatriciaMerkleTree { - /// Returns the node with given full (Merkle) index, if it exists. - fn get_node(full_index: u128) -> Option; - - /// Returns the root if the tree is not empty. - fn get_root() -> Option; - - /// Computes the hash of the given node. - fn compute_hash(node: PatriciaMerkleNode) -> StarkFelt; -} diff --git a/crates/committer/src/patricia_merkle_tree/tree.rs b/crates/committer/src/patricia_merkle_tree/tree.rs new file mode 100644 index 00000000..30e97007 --- /dev/null +++ b/crates/committer/src/patricia_merkle_tree/tree.rs @@ -0,0 +1,13 @@ +use crate::patricia_merkle_tree::node::Node; + + +trait Tree { + /// Returns the node with given full (Merkle) index, if it exists. + fn get_node(full_index: u128) -> Option; + + /// Returns the root if the tree is not empty. + fn get_root() -> Option; + + /// Computes the hash of the given node. + fn compute_hash(node: Node) -> [u8; 32]; +}