Merge remote-tracking branch 'upstream/master' into witness_at_depth

This commit is contained in:
Kris Nuttycombe 2023-03-03 17:06:36 -07:00
commit 1db85f347e
3 changed files with 10 additions and 2 deletions

View File

@ -7,6 +7,14 @@ and this project adheres to Rust's notion of
## [Unreleased]
## [0.3.1] - 2023-02-28
### Fixed
- A bug affecting 32-bit platforms caused `Position::max_altitude` (which has
been renamed to `Position::root_level`) to return the wrong value. This
typically manifested as failures to add commitments to the tree.
### Added
- `Position::is_odd`

View File

@ -1,7 +1,7 @@
[package]
name = "incrementalmerkletree"
description = "Common types, interfaces, and utilities for Merkle tree data structures"
version = "0.3.0"
version = "0.3.1"
authors = [
"Sean Bowe <ewillbefull@gmail.com>",
"Kris Nuttycombe <kris@nutty.land>",

View File

@ -57,7 +57,7 @@ impl Position {
/// Returns the minimum possible level of the root of a binary tree containing at least
/// `self + 1` nodes.
pub fn root_level(&self) -> Level {
Level(64 - self.0.leading_zeros() as u8)
Level((usize::BITS - self.0.leading_zeros()) as u8)
}
/// Returns the number of cousins and/or ommers required to construct an authentication