Skip to content

Commit f47bb0e

Browse files
committed
mmr_authentication_proof: Apply Alan's suggested name for this witness/proof
1 parent c68f9f9 commit f47bb0e

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed

twenty-first/src/util_types/mmr/mmr_authentication_struct.rs

Lines changed: 8 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const ROOT_MT_INDEX: u64 = 1;
2626
/// A witness to facilitate the proving of the authenticity of a Merkle
2727
/// authentication struct.
2828
#[derive(Debug, Clone)]
29-
pub struct MerkleAuthenticationStructAuthenticityWitness {
29+
pub struct AuthStructIntegrityProof {
3030
// All indices are Merkle tree node indices
3131
pub nd_auth_struct_indices: Vec<u64>,
3232
pub nd_sibling_indices: Vec<(u64, u64)>,
@@ -40,10 +40,10 @@ pub struct MerkleAuthenticationStructAuthenticityWitness {
4040
pub struct AuthenticatedMerkleAuthStruct {
4141
pub auth_struct: Vec<Digest>,
4242
pub indexed_leafs: Vec<(u64, Digest)>,
43-
pub witness: MerkleAuthenticationStructAuthenticityWitness,
43+
pub witness: AuthStructIntegrityProof,
4444
}
4545

46-
impl MerkleAuthenticationStructAuthenticityWitness {
46+
impl AuthStructIntegrityProof {
4747
/// Return the Merkle tree node indices of the digests required to prove
4848
/// membership for the specified leaf indices, as well as the node indices
4949
/// that can be derived from the leaf indices and their authentication
@@ -398,10 +398,7 @@ mod tests {
398398
.collect_vec();
399399

400400
let authenticated_auth_structs =
401-
MerkleAuthenticationStructAuthenticityWitness::new_from_mmr_membership_proofs(
402-
&mmra,
403-
indexed_mmr_mps,
404-
);
401+
AuthStructIntegrityProof::new_from_mmr_membership_proofs(&mmra, indexed_mmr_mps);
405402

406403
let peak_heights = get_peak_heights(mmr_leaf_count);
407404
for (peak_index, authentication_auth_struct) in authenticated_auth_structs {
@@ -437,10 +434,7 @@ mod tests {
437434
.collect_vec();
438435

439436
let authenticity_witnesses =
440-
MerkleAuthenticationStructAuthenticityWitness::new_from_mmr_membership_proofs(
441-
&mmra,
442-
indexed_mmr_mps,
443-
);
437+
AuthStructIntegrityProof::new_from_mmr_membership_proofs(&mmra, indexed_mmr_mps);
444438
assert!(
445439
authenticity_witnesses.len().is_one(),
446440
"All indices belong to first peak"
@@ -479,10 +473,7 @@ mod tests {
479473
.collect_vec();
480474

481475
let authenticity_witnesses =
482-
MerkleAuthenticationStructAuthenticityWitness::new_from_mmr_membership_proofs(
483-
&mmra,
484-
indexed_mmr_mps,
485-
);
476+
AuthStructIntegrityProof::new_from_mmr_membership_proofs(&mmra, indexed_mmr_mps);
486477
assert!(
487478
authenticity_witnesses.len().is_one(),
488479
"All indices belong to first peak"
@@ -518,10 +509,7 @@ mod tests {
518509
let tree = MerkleTree::<Tip5>::new::<CpuParallel>(&leafs).unwrap();
519510

520511
let authenticated_auth_struct =
521-
MerkleAuthenticationStructAuthenticityWitness::new_from_merkle_tree(
522-
&tree,
523-
revealed_leaf_indices,
524-
);
512+
AuthStructIntegrityProof::new_from_merkle_tree(&tree, revealed_leaf_indices);
525513
let AuthenticatedMerkleAuthStruct {
526514
auth_struct,
527515
indexed_leafs,
@@ -566,7 +554,7 @@ mod tests {
566554
})
567555
.collect_vec();
568556

569-
let mmr_auth_struct = MerkleAuthenticationStructAuthenticityWitness {
557+
let mmr_auth_struct = AuthStructIntegrityProof {
570558
nd_auth_struct_indices,
571559
nd_sibling_indices,
572560
nd_siblings,

0 commit comments

Comments
 (0)