rename PrecomputedSubtrees -> PairComputations

This commit is contained in:
Qyriad 2024-11-04 13:01:57 -07:00
parent e908f69d30
commit bc944707dc

View file

@ -352,8 +352,8 @@ pub(crate) trait SparseMerkleTree<const DEPTH: u8> {
fn sorted_pairs_to_leaves( fn sorted_pairs_to_leaves(
pairs: Vec<(Self::Key, Self::Value)>, pairs: Vec<(Self::Key, Self::Value)>,
) -> PrecomputedSubtrees<u64, Self::Leaf> { ) -> PairComputations<u64, Self::Leaf> {
let mut accumulator: PrecomputedSubtrees<u64, Self::Leaf> = Default::default(); let mut accumulator: PairComputations<u64, Self::Leaf> = Default::default();
// The kv-pairs we've seen so far that correspond to a single leaf. // The kv-pairs we've seen so far that correspond to a single leaf.
let mut current_leaf_buffer: Vec<(Self::Key, Self::Value)> = Default::default(); let mut current_leaf_buffer: Vec<(Self::Key, Self::Value)> = Default::default();
@ -632,7 +632,7 @@ impl SubtreeLeaf {
} }
#[derive(Debug, Clone, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq)]
pub struct PrecomputedSubtrees<K, L> { pub(crate) struct PairComputations<K, L> {
/// Literal leaves to be added to the sparse Merkle tree's internal mapping. /// Literal leaves to be added to the sparse Merkle tree's internal mapping.
pub nodes: BTreeMap<K, L>, pub nodes: BTreeMap<K, L>,
/// "Conceptual" leaves that will be used for computations. /// "Conceptual" leaves that will be used for computations.
@ -670,7 +670,7 @@ impl<K, L> PrecomputedSubtrees<K, L> {
} }
// Derive requires `L` to impl Default, even though we don't actually need that. // Derive requires `L` to impl Default, even though we don't actually need that.
impl<K, L> Default for PrecomputedSubtrees<K, L> { impl<K, L> Default for PairComputations<K, L> {
fn default() -> Self { fn default() -> Self {
Self { Self {
nodes: Default::default(), nodes: Default::default(),