Browse Source

Merkle tree fails to compute the root when there's no need in dummy nodes - test

master
Sergey Vasilyev 4 years ago
committed by Pratyush Mishra
parent
commit
f4e2039d61
1 changed files with 10 additions and 1 deletions
  1. +10
    -1
      crypto-primitives/src/merkle_tree/mod.rs

+ 10
- 1
crypto-primitives/src/merkle_tree/mod.rs

@ -378,7 +378,7 @@ mod test {
struct JubJubMerkleTreeParams;
impl MerkleTreeConfig for JubJubMerkleTreeParams {
const HEIGHT: usize = 32;
const HEIGHT: usize = 8;
type H = H;
}
type JubJubMerkleTree = MerkleHashTree<JubJubMerkleTreeParams>;
@ -409,6 +409,15 @@ mod test {
generate_merkle_tree(&leaves);
}
#[test]
fn no_dummy_nodes_test() {
let mut leaves = Vec::new();
for i in 0..(1u8 << JubJubMerkleTree::HEIGHT - 1) {
leaves.push([i, i, i, i, i, i, i, i]);
}
generate_merkle_tree(&leaves);
}
fn bad_merkle_tree_verify<L: ToBytes + Clone + Eq>(leaves: &[L]) -> () {
let mut rng = XorShiftRng::seed_from_u64(13423423u64);

Loading…
Cancel
Save