Skip to content

Commit

Permalink
fix: latest v1; minor changes on comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sifnoc committed Dec 7, 2023
1 parent c6ed945 commit bdbd2ac
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
8 changes: 4 additions & 4 deletions src/aggregation_merkle_sum_tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -127,8 +127,8 @@ impl<const N_CURRENCIES: usize, const N_BYTES: usize> Tree<N_CURRENCIES, N_BYTES
impl<const N_CURRENCIES: usize, const N_BYTES: usize>
AggregationMerkleSumTree<N_CURRENCIES, N_BYTES>
{
/// 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<MerkleSumTree<N_CURRENCIES, N_BYTES>>,
cryptocurrencies: Vec<Cryptocurrency>,
Expand Down Expand Up @@ -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::<N_CURRENCIES, N_BYTES>::from_csv("src/orchestrator/csv/entry_16.csv")
Expand Down
2 changes: 1 addition & 1 deletion src/json_mst.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl JsonMerkleSumTree {
N_CURRENCIES
];

MerkleSumTree::<N_CURRENCIES, N_BYTES>::new(
MerkleSumTree::<N_CURRENCIES, N_BYTES>::from_params(
root,
nodes,
self.depth,
Expand Down
14 changes: 7 additions & 7 deletions src/mini_tree_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -21,6 +16,11 @@ const N_BYTES: usize = 14;
/// It converts `JsonEntry` objects into `Entry<N_CURRENCIES>` 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<Vec<JsonEntry>>,
) -> Result<impl IntoResponse, (StatusCode, Json<JsonMerkleSumTree>)> {
Expand Down

0 comments on commit bdbd2ac

Please sign in to comment.