rename PrecomputedSubtrees -> PairComputations

This commit is contained in:
Qyriad 2024-11-04 13:01:57 -07:00
parent 4346820b5a
commit dd12788ea9

View file

@ -352,8 +352,8 @@ pub(crate) trait SparseMerkleTree<const DEPTH: u8> {
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();
@ -633,7 +633,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.
@ -641,7 +641,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(),