diff --git a/README.md b/README.md index 21bbd86..d9d6549 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Summa Aggregation -Summa Aggregation is a scalable solution specifically designed to accelerate the process of building Merkle sum trees. It addresses the time-intensive challenge of constructing these trees by enabling efficient scaling through parallelization and distributed computation across multiple machines. +Summa Aggregation is a scalable solution specifically designed to accelerate the process of building Merkle sum tree. It addresses the time-intensive challenge of constructing these trees by enabling efficient scaling through parallelization and distributed computation across multiple machines. ## Running test diff --git a/src/aggregation_merkle_sum_tree.rs b/src/aggregation_merkle_sum_tree.rs index 3a5abbb..586c290 100644 --- a/src/aggregation_merkle_sum_tree.rs +++ b/src/aggregation_merkle_sum_tree.rs @@ -8,7 +8,7 @@ use summa_backend::merkle_sum_tree::{ /// Aggregation Merkle Sum Tree Data Structure. /// -/// Starting from a set of "mini" Merkle Sum Trees of equal depth, N_CURRENCIES and N_BYTES, the Aggregation Merkle Sum Tree inherits the properties of a Merkle Sum Tree and adds the following: +/// Starting from a set of "mini" Merkle Sum Tree of equal depth, N_CURRENCIES and N_BYTES, the Aggregation Merkle Sum Tree inherits the properties of a Merkle Sum Tree and adds the following: /// * Each Leaf of the Aggregation Merkle Sum Tree is the root of a "mini" Merkle Sum Tree made of `hash` and `balances` /// /// # Type Parameters @@ -127,8 +127,8 @@ impl Tree AggregationMerkleSumTree { - /// Builds a AggregationMerkleSumTree from a set of mini MerkleSumTrees - /// The leaves of the AggregationMerkleSumTree are the roots of the mini MerkleSumTrees + /// Builds a AggregationMerkleSumTree from a set of mini MerkleSumTree + /// The leaves of the AggregationMerkleSumTree are the roots of the mini MerkleSumTree pub fn new( mini_trees: Vec>, cryptocurrencies: Vec, @@ -297,7 +297,7 @@ mod test { #[test] fn test_aggregation_mst_overflow() { - // create new mini merkle sum trees. The accumulated balance for each mini tree is in the expected range + // create new mini merkle sum tree. The accumulated balance for each mini tree is in the expected range // note that the accumulated balance of the tree generated from entry_16_4 is just in the expected range for 1 unit let merkle_sum_tree_1 = MerkleSumTree::::from_csv("src/orchestrator/csv/entry_16.csv") diff --git a/src/json_mst.rs b/src/json_mst.rs index ae703ef..25e4ed9 100644 --- a/src/json_mst.rs +++ b/src/json_mst.rs @@ -136,7 +136,7 @@ impl JsonMerkleSumTree { N_CURRENCIES ]; - MerkleSumTree::::new( + MerkleSumTree::::from_params( root, nodes, self.depth, diff --git a/src/mini_tree_generator.rs b/src/mini_tree_generator.rs index 79900cd..286f280 100644 --- a/src/mini_tree_generator.rs +++ b/src/mini_tree_generator.rs @@ -4,13 +4,8 @@ use const_env::from_env; use crate::json_mst::{JsonEntry, JsonMerkleSumTree}; use summa_backend::merkle_sum_tree::{Cryptocurrency, Entry, MerkleSumTree}; -#[from_env] -const N_CURRENCIES: usize = 2; -#[from_env] -const N_BYTES: usize = 14; - -/// Mini Tree Generator is designed to create Merkle Sum Trees using the Axum web framework. -/// It primarily handles HTTP requests to generate trees based on provided JSON entries. +/// Mini Tree Generator is designed to create Merkle Sum Tree using the Axum web framework. +/// It primarily handles HTTP requests to generate tree based on provided JSON entries. /// /// Constants: /// - `N_CURRENCIES`: The number of cryptocurrencies involved. Set via environment variables. @@ -21,6 +16,11 @@ const N_BYTES: usize = 14; /// It converts `JsonEntry` objects into `Entry` instances and then constructs the `MerkleSumTree`. /// The function handles the conversion of the `MerkleSumTree` into a JSON format (`JsonMerkleSumTree`) for the response. /// +#[from_env] +const N_CURRENCIES: usize = 2; +#[from_env] +const N_BYTES: usize = 14; + pub async fn create_mst( Json(json_entries): Json>, ) -> Result)> {