Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
mrain committed Oct 23, 2024
1 parent 11e0f4d commit 808d83c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 3 additions & 3 deletions merkle_tree/src/internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use super::{
DigestAlgorithm, Element, Index, LookupResult, MerkleCommitment, NodeValue, ToTraversalPath,
};
use crate::{errors::MerkleTreeError, prelude::MerkleTree, VerificationResult};
use crate::{errors::MerkleTreeError, prelude::MerkleTree, VerificationResult, FAILED, SUCCESS};
use alloc::sync::Arc;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize};
use ark_std::{borrow::Borrow, format, iter::Peekable, string::ToString, vec, vec::Vec};
Expand Down Expand Up @@ -197,9 +197,9 @@ where
},
)?;
if computed_root == commitment.digest() {
Ok(Ok(()))
Ok(SUCCESS)
} else {
Ok(Err(()))
Ok(FAILED)
}
}

Expand Down
4 changes: 4 additions & 0 deletions merkle_tree/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ use serde::{Deserialize, Serialize};

/// Glorified bool type
pub(crate) type VerificationResult = Result<(), ()>;
/// Glorified true
pub const SUCCESS: VerificationResult = Ok(());
/// Glorified false
pub const FAILED: VerificationResult = Err(());

#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
/// The result of querying at an index in the tree
Expand Down
2 changes: 1 addition & 1 deletion merkle_tree/src/light_weight.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ where
#[cfg(test)]
mod mt_tests {
use crate::{
internal::{MerkleNode, MerkleTreeProof},
internal::MerkleNode,
prelude::{RescueLightWeightMerkleTree, RescueMerkleTree},
*,
};
Expand Down

0 comments on commit 808d83c

Please sign in to comment.