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.
Tests can be run using the following command:
cargo test --release
Note: The Worker will run locally and uses port 4000 as the default for its server. Please ensure that this port is not already in use to avoid errors.
For additional tests involving Docker and Docker Swarm mode, the presence of the "summadev/summa-aggregation-mini-tree" image in the local Docker registry is required. Please refer to the Mini Tree Server for more information about the mini tree.
Build the image using the following command:
docker build . -t summadev/summa-aggregation-mini-tree
Alternatively, the image can be downloaded from Docker Hub:
docker pull summadev/summa-aggregation-mini-tree
The following command runs an additional test case using the LocalSpawner, which spawns worker containers in the local Docker environment. This extra test case involves running two containers during the testing process:
cargo test --features docker
For Summa-Aggregation, it's necessary to prepare a distributed environment where Workers can operate on remote machines, referred to as 'Nodes'. For guidance on setting up swarm nodes, please see Getting Started with swarm mode
When the Docker environment is running successfully in Swarm mode, an additional test case that spawns workers on Swarm nodes using the CloudSpawner
can be run:
cargo test --features docker-swarm
It is critical to ensure that the Docker Swarm includes at least one node connected to the manager node. Additionally, each worker node in the swarm must have the "summadev/summa-aggregation-mini-tree" image in its Docker registry. Without this image on nodes connected to the manager node, spawning workers on that node is not possible.
This example demonstrates the setup and operation of a distributed environment using Summa Aggregation, including the initialization of round and generating inclusion proof. A notable aspect of this demonstration is how the AggregationMerkleSumTree can produce the generation of inclusion proofs, similarly to the MerkleSumTree.
Custodians can leverage any cloud infrastructure to establish worker nodes. In this example, we use two local servers running mini-tree services as workers, rather than deploying worker containers on remote nodes.
Key steps:
-
Spawning Worker Nodes: Two local servers are spawned, each running a mini-tree service.
-
Worker URLs: It is crucial to ensure the number of worker URLs matches the number of executors. In this example, we use
127.0.0.1:4000
and127.0.0.1:4001
.
Initiating the round with an AggregationMerkleSumTree
is a key step after setting up the distributed environment with worker nodes. This process involves the Orchestrator
and the Round
.
-
Orchestrator and AggregationMerkleSumTree: The
Orchestrator
is initialized with theCloudSpawner
and paths to the CSV files containing entry data. It uses this information to generate theAggregationMerkleSumTree
, which forms the basis for the round's operations. -
Round Initialization: Subsequently, the
Round
is initialized using the aggregation merkle sum tree. TheRound
is integral for interactions with the Summa contract and relies on the setup performed by theOrchestrator
.
The actual example only shows the creation of an inclusion proof.
For detailed information on interaction patterns similar to those in the summa-backend
example, refer to the 'summa_solvency_flow'.
Run the example using the following command:
cargo run --release --example aggregation_flow