mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-12 09:01:29 +01:00
fix: add validation to NodeIndex constructor and remove BitIterator
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
use super::{
|
||||
hash::rpo::{Rpo256, RpoDigest},
|
||||
utils::collections::{vec, BTreeMap, BTreeSet, Vec},
|
||||
utils::collections::{vec, BTreeMap, Vec},
|
||||
Felt, StarkField, Word, WORD_SIZE, ZERO,
|
||||
};
|
||||
use core::fmt;
|
||||
@@ -45,7 +45,7 @@ pub enum MerkleError {
|
||||
DepthTooBig(u64),
|
||||
NodeNotInStore(Word, NodeIndex),
|
||||
NumLeavesNotPowerOfTwo(usize),
|
||||
InvalidIndex(NodeIndex),
|
||||
InvalidIndex { depth: u8, value: u64 },
|
||||
InvalidDepth { expected: u8, provided: u8 },
|
||||
InvalidPath(MerklePath),
|
||||
InvalidEntriesCount(usize, usize),
|
||||
@@ -63,9 +63,9 @@ impl fmt::Display for MerkleError {
|
||||
NumLeavesNotPowerOfTwo(leaves) => {
|
||||
write!(f, "the leaves count {leaves} is not a power of 2")
|
||||
}
|
||||
InvalidIndex(index) => write!(
|
||||
InvalidIndex{ depth, value} => write!(
|
||||
f,
|
||||
"the index value {} is not valid for the depth {}", index.value(), index.depth()
|
||||
"the index value {value} is not valid for the depth {depth}"
|
||||
),
|
||||
InvalidDepth { expected, provided } => write!(
|
||||
f,
|
||||
|
||||
Reference in New Issue
Block a user