From a8ac76535b6ef709c3b2238574317214fb097551 Mon Sep 17 00:00:00 2001 From: DaniPopes <57450786+DaniPopes@users.noreply.github.com> Date: Wed, 20 Dec 2023 13:27:50 +0100 Subject: [PATCH] chore: increase visibility --- src/hash_builder/mod.rs | 21 +++++++++++---------- src/mask.rs | 6 ++++++ src/nodes/branch.rs | 26 -------------------------- 3 files changed, 17 insertions(+), 36 deletions(-) diff --git a/src/hash_builder/mod.rs b/src/hash_builder/mod.rs index 58bd1cc..a639492 100644 --- a/src/hash_builder/mod.rs +++ b/src/hash_builder/mod.rs @@ -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>, - value: HashBuilderValue, + pub key: Nibbles, + pub stack: Vec>, + pub value: HashBuilderValue, - groups: Vec, - tree_masks: Vec, - hash_masks: Vec, + pub groups: Vec, + pub tree_masks: Vec, + pub hash_masks: Vec, - stored_in_database: bool, + pub stored_in_database: bool, - updated_branch_nodes: Option>, - proof_retainer: Option, + pub updated_branch_nodes: Option>, + pub proof_retainer: Option, - rlp_buf: Vec, + pub rlp_buf: Vec, } impl HashBuilder { diff --git a/src/mask.rs b/src/mask.rs index a1544b6..393563b 100644 --- a/src/mask.rs +++ b/src/mask.rs @@ -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 { diff --git a/src/nodes/branch.rs b/src/nodes/branch.rs index 6071e92..dd818c5 100644 --- a/src/nodes/branch.rs +++ b/src/nodes/branch.rs @@ -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); - } -} -*/