mirror of
https://github.com/arnaucube/miden-crypto.git
synced 2026-01-12 00:51:29 +01:00
refactor: refactor crypto APIs to use RpoDigest instead of Word
This commit is contained in:
@@ -10,7 +10,6 @@ use core::fmt;
|
||||
|
||||
mod empty_roots;
|
||||
pub use empty_roots::EmptySubtreeRoots;
|
||||
use empty_roots::EMPTY_WORD;
|
||||
|
||||
mod index;
|
||||
pub use index::NodeIndex;
|
||||
@@ -44,7 +43,7 @@ pub use node::InnerNodeInfo;
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum MerkleError {
|
||||
ConflictingRoots(Vec<Word>),
|
||||
ConflictingRoots(Vec<RpoDigest>),
|
||||
DepthTooSmall(u8),
|
||||
DepthTooBig(u64),
|
||||
DuplicateValuesForIndex(u64),
|
||||
@@ -54,9 +53,9 @@ pub enum MerkleError {
|
||||
InvalidPath(MerklePath),
|
||||
InvalidNumEntries(usize, usize),
|
||||
NodeNotInSet(NodeIndex),
|
||||
NodeNotInStore(Word, NodeIndex),
|
||||
NodeNotInStore(RpoDigest, NodeIndex),
|
||||
NumLeavesNotPowerOfTwo(usize),
|
||||
RootNotInStore(Word),
|
||||
RootNotInStore(RpoDigest),
|
||||
}
|
||||
|
||||
impl fmt::Display for MerkleError {
|
||||
@@ -95,6 +94,11 @@ impl std::error::Error for MerkleError {}
|
||||
// ================================================================================================
|
||||
|
||||
#[cfg(test)]
|
||||
const fn int_to_node(value: u64) -> Word {
|
||||
const fn int_to_node(value: u64) -> RpoDigest {
|
||||
RpoDigest::new([Felt::new(value), ZERO, ZERO, ZERO])
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
const fn int_to_leaf(value: u64) -> Word {
|
||||
[Felt::new(value), ZERO, ZERO, ZERO]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user