diff --git a/src/merkle/smt/full/mod.rs b/src/merkle/smt/full/mod.rs index d8f09027..5cd641e4 100644 --- a/src/merkle/smt/full/mod.rs +++ b/src/merkle/smt/full/mod.rs @@ -255,9 +255,7 @@ impl Smt { >::compute_mutations(self, kv_pairs) } - /// Applies the prospective mutations computed with [`Smt::compute_mutations()`] to - /// this tree and returns the reverse mutation set. Applying the reverse mutation sets to the - /// updated tree will revert the changes. + /// Applies the prospective mutations computed with [`Smt::compute_mutations()`] to this tree. /// /// # Errors /// If `mutations` was computed on a tree with a different root than this one, returns diff --git a/src/merkle/smt/mod.rs b/src/merkle/smt/mod.rs index 637f15f1..9e183231 100644 --- a/src/merkle/smt/mod.rs +++ b/src/merkle/smt/mod.rs @@ -182,6 +182,8 @@ pub(crate) trait SparseMerkleTree { ) -> MutationSet where Self: Sized + Sync, + Self::Key: Send + Sync, + Self::Value: Send + Sync, { #[cfg(feature = "concurrent")] { @@ -307,12 +309,14 @@ pub(crate) trait SparseMerkleTree { ) -> MutationSet where Self: Sized + Sync, + Self::Key: Send + Sync, + Self::Value: Send + Sync, { use rayon::prelude::*; // Collect and sort key-value pairs by their corresponding leaf index let mut sorted_kv_pairs: Vec<_> = kv_pairs.into_iter().collect(); - sorted_kv_pairs.sort_unstable_by_key(|(key, _)| Self::key_to_leaf_index(key).value()); + sorted_kv_pairs.par_sort_unstable_by_key(|(key, _)| Self::key_to_leaf_index(key).value()); // Convert sorted pairs into mutated leaves and capture any new pairs let (mut subtree_leaves, new_pairs) =