fn modify_proof<
        E: Element,
        A: Algorithm<E>,
        BaseTreeArity: Unsigned,
        SubTreeArity: Unsigned,
        TopTreeArity: Unsigned,
    >(
        proof: &mut Proof<E, BaseTreeArity>,
    ) {
        use rand::prelude::*;

        if TopTreeArity::to_usize() > 0 {
            assert!(proof.sub_tree_proof.is_some());
            assert!(proof
                .sub_tree_proof
                .as_ref()
                .unwrap()
                .sub_tree_proof
                .is_some());
        } else if SubTreeArity::to_usize() > 0 {
            assert!(proof.sub_tree_proof.is_some());
        }

        let mut hasher_alg = A::default();
        let mut tmp = vec![0u8; E::byte_len()];

        if TopTreeArity::to_usize() > 0 || SubTreeArity::to_usize() > 0 {
            let i = random::<usize>() % proof.sub_tree_proof.as_ref().unwrap().lemma().len();
            let j = random::<usize>();

            j.hash(&mut hasher_alg);

            // Break random sub-tree proof element
            proof.sub_tree_proof.as_ref().unwrap().lemma()[i].copy_to_slice(&mut tmp);
            tmp.hash(&mut hasher_alg);
            proof.sub_tree_proof.as_mut().unwrap().lemma_mut()[i] = hasher_alg.hash();
        } else {
            let i = random::<usize>() % proof.lemma.len();
            let k = random::<usize>();

            k.hash(&mut hasher_alg);

            // Break random element
            proof.lemma[i].copy_to_slice(&mut tmp);
            tmp.hash(&mut hasher_alg);
            proof.lemma[i] = hasher_alg.hash();
        }
    }
// Break one element inside the proof's top layer (if available).
// Otherwise, break the sub-proof.
Break one element inside the proof's top layer (if available).
Otherwise, break the sub-proof.
Break one element inside the proof ' s top layer ( if available ) . Otherwise break the sub - proof .
fn modify_proof<
        E: Element,
        A: Algorithm<E>,
        BaseTreeArity: Unsigned,
        SubTreeArity: Unsigned,
        TopTreeArity: Unsigned,
    >(
        proof: &mut Proof<E, BaseTreeArity>,
    ) {
        use rand::prelude::*;
        if TopTreeArity::to_usize() > 0 {
            assert!(proof.sub_tree_proof.is_some());
            assert!(proof
                .sub_tree_proof
                .as_ref()
                .unwrap()
                .sub_tree_proof
                .is_some());
        } else if SubTreeArity::to_usize() > 0 {
            assert!(proof.sub_tree_proof.is_some());
        }
        let mut hasher_alg = A::default();
        let mut tmp = vec![0u8; E::byte_len()];
        if TopTreeArity::to_usize() > 0 || SubTreeArity::to_usize() > 0 {
            let i = random::<usize>() % proof.sub_tree_proof.as_ref().unwrap().lemma().len();
            let j = random::<usize>();
            j.hash(&mut hasher_alg);
            // Break random sub-tree proof element
            proof.sub_tree_proof.as_ref().unwrap().lemma()[i].copy_to_slice(&mut tmp);
            tmp.hash(&mut hasher_alg);
            proof.sub_tree_proof.as_mut().unwrap().lemma_mut()[i] = hasher_alg.hash();
        } else {
            let i = random::<usize>() % proof.lemma.len();
            let k = random::<usize>();
            k.hash(&mut hasher_alg);
            // Break random element
            proof.lemma[i].copy_to_slice(&mut tmp);
            tmp.hash(&mut hasher_alg);
            proof.lemma[i] = hasher_alg.hash();
        }
    }
fn modify_proof < E : Element , A : Algorithm < E > , BaseTreeArity : Unsigned , SubTreeArity : Unsigned , TopTreeArity : Unsigned , > ( proof : & mut Proof < E , BaseTreeArity > , ) { use rand :: prelude :: * ; if TopTreeArity :: to_usize ( ) > 0 { assert ! ( proof sub_tree_proof is_some ( ) ) ; assert ! ( proof sub_tree_proof as_ref ( ) unwrap ( ) sub_tree_proof is_some ( ) ) ; } else if SubTreeArity :: to_usize ( ) > 0 { assert ! ( proof sub_tree_proof is_some ( ) ) ; } let mut hasher_alg = A :: default ( ) ; let mut tmp = vec ! [ 0u8 E byte_len ( ) ] ; if TopTreeArity :: to_usize ( ) > 0 || SubTreeArity :: to_usize ( ) > 0 { let i = random :: < usize > ( ) % proof . sub_tree_proof . as_ref ( ) . unwrap ( ) . lemma ( ) . len ( ) ; let j = random :: < usize > ( ) ; j . hash ( & mut hasher_alg ) ; // Break random sub-tree proof element proof . sub_tree_proof . as_ref ( ) . unwrap ( ) . lemma ( ) [ i ] . copy_to_slice ( & mut tmp ) ; tmp . hash ( & mut hasher_alg ) ; proof . sub_tree_proof . as_mut ( ) . unwrap ( ) . lemma_mut ( ) [ i ] = hasher_alg . hash ( ) ; } else { let i = random :: < usize > ( ) % proof . lemma . len ( ) ; let k = random :: < usize > ( ) ; k . hash ( & mut hasher_alg ) ; // Break random element proof . lemma [ i ] . copy_to_slice ( & mut tmp ) ; tmp . hash ( & mut hasher_alg ) ; proof . lemma [ i ] = hasher_alg . hash ( ) ; } }
Break one element inside the proof's top layer (if available).
Break one element inside the proof ' s top layer ( if available ) .
proof
&mut Proof<E, BaseTreeArity>