Apply suggestions from code review.

This commit is contained in:
Kris Nuttycombe 2023-06-29 15:26:56 -06:00
parent 30c592a0b3
commit 701d3e6311
3 changed files with 4 additions and 4 deletions

View File

@ -203,8 +203,8 @@ impl<H, const DEPTH: u8> Frontier<H, DEPTH> {
/// Constructs a new frontier from its constituent parts.
///
/// Returns `None` if the new frontier would exceed the maximum allowed depth or if the list of
/// ommers provided is not consistent with the position of the leaf.
/// Returns an error if the new frontier would exceed the maximum allowed depth or if the list
/// of ommers provided is not consistent with the position of the leaf.
pub fn from_parts(position: Position, leaf: H, ommers: Vec<H>) -> Result<Self, FrontierError> {
NonEmptyFrontier::from_parts(position, leaf, ommers).and_then(Self::try_from)
}

View File

@ -425,7 +425,7 @@ impl Address {
}
}
/// Returns whether this address is the right-hand child of its parent
/// Returns whether this address is the left-hand child of its parent
pub fn is_left_child(&self) -> bool {
self.index & 0x1 == 0
}

View File

@ -102,7 +102,7 @@ impl<H, const DEPTH: u8> IncrementalWitness<H, DEPTH> {
}
})
.take(self.filled.len())
.fold(0u64, |acc, addr| acc + 2u64.pow(addr.level().into()));
.fold(0u64, |acc, addr| acc + (1u64 << u8::from(addr.level())));
self.witnessed_position()
+ leaves_to_cursor_start