arnaucube
arnaucube/miden-cryptoPublic Self-hosted repository
Merge pull request #34 from 0xPolygonMiden/bobbin-merkle-derive

Implement PartialEq and Eq traits on Merkle structs
Bobbin Threadbare 43513081+bobbinth@users.noreply.github.com
Wed, 28 Dec 2022 07:00:46 -0800
commit

f51d6b78aa62bcc4b7e4a322f65d34404e330f58

parent

ad2b63ce02c570e2da9cfa842e3afb74c619f5f4

3 files changed, 5 insertions(+), 5 deletions(-)

jump to
M src/merkle/merkle_path_set.rs → src/merkle/merkle_path_set.rs

@@ -4,7 +4,7 @@ // MERKLE PATH SET

// ================================================================================================ /// A set of Merkle paths. -#[derive(Clone, Debug)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct MerklePathSet { root: Word, total_depth: u32,
M src/merkle/merkle_tree.rs → src/merkle/merkle_tree.rs

@@ -7,7 +7,7 @@ // MERKLE TREE

// ================================================================================================ /// A fully-balanced binary Merkle tree (i.e., a tree where the number of leaves is a power of two). -#[derive(Clone, Debug)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct MerkleTree { nodes: Vec<Word>, }
M src/merkle/simple_smt/mod.rs → src/merkle/simple_smt/mod.rs

@@ -9,7 +9,7 @@

/// A sparse Merkle tree with 63-bit keys and 4-element leaf values, without compaction. /// Manipulation and retrieval of leaves and internal nodes is provided by its internal `Store`. /// The root of the tree is recomputed on each new leaf update. -#[derive(Clone, Debug)] +#[derive(Debug, Clone, PartialEq, Eq)] pub struct SimpleSmt { root: Word, depth: u32,

@@ -186,7 +186,7 @@ /// A data store for sparse Merkle tree key-value pairs.

/// Leaves and branch nodes are stored separately in B-tree maps, indexed by key and (key, depth) /// respectively. Hashes for blank subtrees at each layer are stored in `empty_hashes`, beginning /// with the root hash of an empty tree, and ending with the zero value of a leaf node. -#[derive(Clone, Debug)] +#[derive(Debug, Clone, PartialEq, Eq)] struct Store { branches: BTreeMap<(u64, u32), BranchNode>, leaves: BTreeMap<u64, Word>,

@@ -194,7 +194,7 @@ empty_hashes: Vec<RpoDigest>,

depth: u32, } -#[derive(Clone, Debug, Default)] +#[derive(Debug, Default, Clone, PartialEq, Eq)] struct BranchNode { left: RpoDigest, right: RpoDigest,