Skip to content

Commit

Permalink
mmr_authentication_struct: Add for empty MMR / no opened leafs
Browse files Browse the repository at this point in the history
  • Loading branch information
Sword-Smith committed Aug 8, 2024
1 parent 026b350 commit fa70267
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions twenty-first/src/util_types/mmr/mmr_authentication_struct.rs
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,22 @@ mod tests {
}
}

#[test]
fn auth_struct_on_empty_mmr() {
let empty_mmra = MmrAccumulator::init(vec![], 0);
let authenticated_auth_structs =
AuthStructIntegrityProof::new_from_mmr_membership_proofs(&empty_mmra, vec![]);
assert!(authenticated_auth_structs.is_empty());
}

#[test]
fn auth_struct_non_empty_mmr_empty_leaf_list() {
let mmra_10_leafs = MmrAccumulator::new_from_leafs(vec![Digest::default(); 10]);
let authenticated_auth_structs =
AuthStructIntegrityProof::new_from_mmr_membership_proofs(&mmra_10_leafs, vec![]);
assert!(authenticated_auth_structs.is_empty());
}

#[test]
fn auth_struct_from_mmr_mps_test_height_5_9_indices() {
let local_tree_height = 5;
Expand Down

0 comments on commit fa70267

Please sign in to comment.