Skip to content

Commit

Permalink
feat: parallel sub Merkle tree computation in proof computation
Browse files Browse the repository at this point in the history
  • Loading branch information
jpraynaud committed May 23, 2024
1 parent 81f3bc5 commit a956b7d
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mithril-aggregator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ mithril-doc = { path = "../internal/mithril-doc" }
mithril-persistence = { path = "../internal/mithril-persistence" }
openssl = { version = "0.10.63", features = ["vendored"], optional = true }
openssl-probe = { version = "0.1.5", optional = true }
rayon = "1.10.0"
reqwest = { version = "0.12.0", features = ["json"] }
semver = "1.0.21"
serde = { version = "1.0.196", features = ["derive"] }
Expand Down
13 changes: 8 additions & 5 deletions mithril-aggregator/src/services/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,14 @@ impl ProverService for MithrilProverService {
.await?;

// 2 - Compute block ranges sub Merkle trees
let mut mk_trees = BTreeMap::new();
for (block_range, transactions) in block_range_transactions {
let mk_tree = MKTree::new(&transactions)?;
mk_trees.insert(block_range, mk_tree);
}
let mk_trees: StdResult<Vec<(BlockRange, MKTree)>> = block_range_transactions
.into_par_iter()
.map(|(block_range, transactions)| {
let mk_tree = MKTree::new(&transactions)?;
Ok((block_range, mk_tree))
})
.collect();
let mk_trees = BTreeMap::from_iter(mk_trees?);

// 3 - Compute block range roots Merkle map
let mut mk_map = self
Expand Down

0 comments on commit a956b7d

Please sign in to comment.