Skip to content

Commit

Permalink
Misspell and lifetime removal (#26)
Browse files Browse the repository at this point in the history
* Misspell and lifetime removal

* More grammar fixes
  • Loading branch information
citizen-stig committed Jun 18, 2024
1 parent e6b4924 commit e68ae33
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,10 @@ where

let leaves_len = self.leaves().len();
match self.namespace_ranges.entry(namespace) {
crate::maybestd::hash_or_btree_map::Entry::Occupied(entry) => {
hash_or_btree_map::Entry::Occupied(entry) => {
entry.into_mut().end = leaves_len;
}
crate::maybestd::hash_or_btree_map::Entry::Vacant(entry) => {
hash_or_btree_map::Entry::Vacant(entry) => {
entry.insert(leaves_len - 1..leaves_len);
}
}
Expand Down Expand Up @@ -566,7 +566,7 @@ mod tests {
let res = tree.check_range_proof(&root, &leaf_hashes, proof.siblings(), j);
if i != j {
assert!(res.is_ok());
assert!(res.unwrap() == RangeProofType::Complete)
assert_eq!(res.unwrap(), RangeProofType::Complete)
} else {
// Cannot prove the empty range!
assert!(res.is_err())
Expand Down
2 changes: 1 addition & 1 deletion src/namespaced_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl<const NS_ID_SIZE: usize> Default for NamespacedSha2Hasher<NS_ID_SIZE> {
}
}

/// An extension of [`MerkleHash`] indicating the the hasher is namespace aware. This allows for the creation of
/// An extension of [`MerkleHash`] indicating that the hasher is namespace aware. This allows for the creation of
/// namespaced merkle trees and namespaced merkle proofs.
pub trait NamespaceMerkleHasher<const NS_ID_SIZE: usize>: MerkleHash {
/// Create a new hasher which ignores the max namespace
Expand Down
2 changes: 1 addition & 1 deletion src/nmt_proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub enum NamespaceProof<M: MerkleHash, const NS_ID_SIZE: usize> {
proof: Proof<M>,
/// Whether to treat the maximum possible namespace as a special marker value and ignore it in computing namespace ranges
ignore_max_ns: bool,
/// A leaf that *is* present in the tree, if the namespce being proven absent falls within
/// A leaf that *is* present in the tree, if the namespace being proven absent falls within
/// the namespace range covered by the root.
leaf: Option<NamespacedHash<NS_ID_SIZE>>,
},
Expand Down
2 changes: 1 addition & 1 deletion src/simple_merkle/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl<
pub enum Node<H> {
/// A leaf node contains raw data
Leaf(Vec<u8>),
/// An inner node is the concatention of two child nodes
/// An inner node is the concatenation of two child nodes
Inner(H, H),
}

Expand Down
8 changes: 4 additions & 4 deletions src/simple_merkle/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ use crate::maybestd::{boxed::Box, fmt::Debug, hash::Hash, ops::Range, vec::Vec};
/// Manually implement the method we need from #[feature(slice_take)] to
/// allow building with stable;
trait TakeLast<T> {
fn slice_take_last<'a>(self: &mut &'a Self) -> Option<&'a T>;
fn slice_take_last(self: &mut &Self) -> Option<&T>;
}

impl<T> TakeLast<T> for [T] {
fn slice_take_last<'a>(self: &mut &'a Self) -> Option<&'a T> {
fn slice_take_last(self: &mut &Self) -> Option<&T> {
let (last, rem) = self.split_last()?;
*self = rem;
Some(last)
Expand All @@ -20,7 +20,7 @@ impl<T> TakeLast<T> for [T] {

type BoxedVisitor<M> = Box<dyn Fn(&<M as MerkleHash>::Output)>;

/// Implments an RFC 6962 compatible merkle tree over an in-memory data store which maps preimages to hashes.
/// Implements an RFC 6962 compatible merkle tree over an in-memory data store which maps preimages to hashes.
pub struct MerkleTree<Db, M>
where
M: MerkleHash,
Expand Down Expand Up @@ -196,7 +196,7 @@ where
// We're now done with the left subtrie
if range_to_prove.start >= split_point {
out.push(l.clone())
// If the range of nodes to prove completely contains the left subtrie, then we don't need to recurse.
// If the range of nodes to prove completely contains the left subtrie, then we don't need to recurse.
} else if range_to_prove.start > subtrie_range.start
|| range_to_prove.end < split_point
{
Expand Down
2 changes: 1 addition & 1 deletion src/simple_merkle/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn compute_tree_size(
remaining_right_siblings -= 1;
}
mask <<= 1;
// Ensure that the next iteration won't overflow on 32 bit platforms
// Ensure that the next iteration won't overflow on 32-bit platforms
if index_of_final_node == u32::MAX as usize {
return Err(RangeProofError::TreeTooLarge);
}
Expand Down

0 comments on commit e68ae33

Please sign in to comment.