rename PrecomputedSubtrees -> PairComputations

This commit is contained in:
Qyriad 2024-11-04 13:01:57 -07:00
parent 60d49e247d
commit 5999954391

View file

@ -353,8 +353,8 @@ pub(crate) trait SparseMerkleTree<const DEPTH: u8> {
#[cfg_attr(not(test), allow(dead_code))]
fn sorted_pairs_to_leaves(
pairs: Vec<(Self::Key, Self::Value)>,
) -> PrecomputedSubtrees<u64, Self::Leaf> {
let mut accumulator: PrecomputedSubtrees<u64, Self::Leaf> = Default::default();
) -> PairComputations<u64, Self::Leaf> {
let mut accumulator: PairComputations<u64, Self::Leaf> = Default::default();
// 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();
@ -634,7 +634,7 @@ impl SubtreeLeaf {
/// Helper struct to organize the return value of [`SparseMerkleTree::sorted_pairs_to_leaves()`].
#[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.
pub nodes: BTreeMap<K, L>,
/// "Conceptual" leaves that will be used for computations.
@ -642,7 +642,7 @@ pub struct PrecomputedSubtrees<K, L> {
}
// 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 {
Self {
nodes: Default::default(),