Skip to content

Commit

Permalink
chore: increase visibility
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Dec 20, 2023
1 parent 632d418 commit a8ac765
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 36 deletions.
21 changes: 11 additions & 10 deletions src/hash_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,22 @@ pub use proof_retainer::ProofRetainer;
/// can then be used to verify the integrity and authenticity of the trie's data by constructing and
/// verifying Merkle proofs.
#[derive(Debug, Default)]
#[allow(missing_docs)]
pub struct HashBuilder {
key: Nibbles,
stack: Vec<Vec<u8>>,
value: HashBuilderValue,
pub key: Nibbles,
pub stack: Vec<Vec<u8>>,
pub value: HashBuilderValue,

groups: Vec<TrieMask>,
tree_masks: Vec<TrieMask>,
hash_masks: Vec<TrieMask>,
pub groups: Vec<TrieMask>,
pub tree_masks: Vec<TrieMask>,
pub hash_masks: Vec<TrieMask>,

stored_in_database: bool,
pub stored_in_database: bool,

updated_branch_nodes: Option<HashMap<Nibbles, BranchNodeCompact>>,
proof_retainer: Option<ProofRetainer>,
pub updated_branch_nodes: Option<HashMap<Nibbles, BranchNodeCompact>>,
pub proof_retainer: Option<ProofRetainer>,

rlp_buf: Vec<u8>,
pub rlp_buf: Vec<u8>,
}

impl HashBuilder {
Expand Down
6 changes: 6 additions & 0 deletions src/mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ impl TrieMask {
Self(inner)
}

/// Returns the inner value of the `TrieMask`.
#[inline]
pub const fn get(self) -> u16 {
self.0
}

/// Creates a new `TrieMask` from the given nibble.
#[inline]
pub const fn from_nibble(nibble: u8) -> Self {
Expand Down
26 changes: 0 additions & 26 deletions src/nodes/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,29 +134,3 @@ impl BranchNodeCompact {
self.hashes[index as usize]
}
}

/*
#[cfg(test)]
mod tests {
use super::*;
use alloy_primitives::hex;
#[test]
fn node_encoding() {
let n = BranchNodeCompact::new(
0xf607,
0x0005,
0x4004,
vec![
hex!("90d53cd810cc5d4243766cd4451e7b9d14b736a1148b26b3baac7617f617d321").into(),
hex!("cc35c964dda53ba6c0b87798073a9628dbc9cd26b5cce88eb69655a9c609caf1").into(),
],
Some(hex!("aaaabbbb0006767767776fffffeee44444000005567645600000000eeddddddd").into()),
);
let mut out = Vec::new();
let compact_len = BranchNodeCompact::to_compact(n.clone(), &mut out);
assert_eq!(BranchNodeCompact::from_compact(&out, compact_len).0, n);
}
}
*/

0 comments on commit a8ac765

Please sign in to comment.