mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-12 00:51:29 +01:00
bugfix: reverse merkle path to match other structures
The store builds the path from root to leaf, this updates the code to return a path from leaf to root, as it is done by the other structures. This also added custom error for missing root.
This commit is contained in:
@@ -40,13 +40,14 @@ pub enum MerkleError {
|
||||
ConflictingRoots(Vec<Word>),
|
||||
DepthTooSmall(u8),
|
||||
DepthTooBig(u64),
|
||||
NodeNotInStorage(Word, NodeIndex),
|
||||
NodeNotInStore(Word, NodeIndex),
|
||||
NumLeavesNotPowerOfTwo(usize),
|
||||
InvalidIndex(NodeIndex),
|
||||
InvalidDepth { expected: u8, provided: u8 },
|
||||
InvalidPath(MerklePath),
|
||||
InvalidEntriesCount(usize, usize),
|
||||
NodeNotInSet(u64),
|
||||
RootNotInStore(Word),
|
||||
}
|
||||
|
||||
impl fmt::Display for MerkleError {
|
||||
@@ -70,7 +71,8 @@ impl fmt::Display for MerkleError {
|
||||
InvalidPath(_path) => write!(f, "the provided path is not valid"),
|
||||
InvalidEntriesCount(max, provided) => write!(f, "the provided number of entries is {provided}, but the maximum for the given depth is {max}"),
|
||||
NodeNotInSet(index) => write!(f, "the node indexed by {index} is not in the set"),
|
||||
NodeNotInStorage(hash, index) => write!(f, "the node {:?} indexed by {} and depth {} is not in the storage", hash, index.value(), index.depth(),),
|
||||
NodeNotInStore(hash, index) => write!(f, "the node {:?} indexed by {} and depth {} is not in the storage", hash, index.value(), index.depth(),),
|
||||
RootNotInStore(root) => write!(f, "the root {:?} is not in the storage", root),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user