Skip to content

Commit

Permalink
update CHANGELOG, better Debug for MTNode
Browse files Browse the repository at this point in the history
  • Loading branch information
alxiong committed Oct 27, 2024
1 parent 96e8021 commit 95584ac
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions merkle_tree/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Merkle proof verification proof APIs now takes `MerkleCommitment` instead of simply a root digest
value. It can now be called without instantiating an actual Merkle tree struct.
- Deprecate namespace Merkle tree for now because it's no longer in use.
- [#685](https://github.com/EspressoSystems/jellyfish/pull/685) Include a keccak256 Merkle trees in prelude

## 0.1.0

Expand Down
1 change: 1 addition & 0 deletions merkle_tree/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ derivative = { workspace = true }
digest = { workspace = true }
displaydoc = { workspace = true }
hashbrown = { workspace = true }
hex = "0.4.3"
itertools = { workspace = true, features = ["use_alloc"] }
jf-relation = { version = "0.4.4", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", optional = true, default-features = false }
jf-rescue = { version = "0.1.0", git = "https://github.com/EspressoSystems/jellyfish", tag = "0.4.5", default-features = false }
Expand Down
12 changes: 10 additions & 2 deletions merkle_tree/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use ark_serialize::{
CanonicalDeserialize, CanonicalSerialize, Compress, Read, SerializationError, Valid, Validate,
Write,
};
use ark_std::{marker::PhantomData, vec::Vec};
use ark_std::{fmt, marker::PhantomData, vec::Vec};
use jf_rescue::{crhf::RescueCRHF, RescueParameter};
use sha3::{Digest, Keccak256, Sha3_256};

Expand Down Expand Up @@ -63,9 +63,17 @@ pub type RescueSparseMerkleTree<I, F> = UniversalMerkleTree<F, RescueHash<F>, I,
macro_rules! impl_mt_hash_256 {
($hasher:ident, $node_name:ident, $digest_name:ident) => {
/// Internal node for merkle tree
#[derive(Default, Eq, PartialEq, Clone, Copy, Debug, Ord, PartialOrd, Hash)]
#[derive(Default, Eq, PartialEq, Clone, Copy, Ord, PartialOrd, Hash)]
pub struct $node_name(pub(crate) [u8; 32]);

impl fmt::Debug for $node_name {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple(&stringify!($node_name))
.field(&hex::encode(self.0))
.finish()
}
}

impl AsRef<[u8]> for $node_name {
fn as_ref(&self) -> &[u8] {
&self.0
Expand Down

0 comments on commit 95584ac

Please sign in to comment.