pub fn chunking_proof_into_miracl(proof: &ZKProofDec) -> Result<ProofChunking, ()> {
    // TODO: return type
    let chunking_proof = ProofChunking {
        y0: miracl_g1_from_bytes(proof.first_move_y0.as_bytes())?,
        bb: proof.first_move_b[..]
            .iter()
            .map(|g1| miracl_g1_from_bytes(g1.as_bytes()))
            .collect::<Result<_, _>>()?,
        cc: proof.first_move_c[..]
            .iter()
            .map(|g1| miracl_g1_from_bytes(g1.as_bytes()))
            .collect::<Result<_, _>>()?,
        dd: proof.second_move_d[..]
            .iter()
            .map(|g1| miracl_g1_from_bytes(g1.as_bytes()))
            .collect::<Result<_, _>>()?,
        yy: miracl_g1_from_bytes(proof.second_move_y.as_bytes())?,
        z_r: proof
            .response_z_r
            .iter()
            .map(|fr| miracl_fr_from_bytes(fr.as_bytes()))
            .collect::<Result<_, _>>()?,
        z_s: proof.response_z_s[..]
            .iter()
            .map(|fr| miracl_fr_from_bytes(fr.as_bytes()))
            .collect::<Result<_, _>>()?,
        z_beta: miracl_fr_from_bytes(proof.response_z_b.as_bytes())?,
    };
    if chunking_proof.dd.len() != chunking_proof.z_r.len() + 1 {
        return Err(());
    }
    Ok(chunking_proof)
}
/// Parses a chunking proof from the standard form into a miracl-compatible
/// type.
///
/// # Errors
/// This will return an error if any of the group elements is invalid.
Parses a chunking proof from the standard form into a miracl-compatible
type.
Parses a chunking proof from the standard form into a miracl - compatible type .
pub fn chunking_proof_into_miracl(proof: &ZKProofDec) -> Result<ProofChunking, ()> {
    // TODO: return type
    let chunking_proof = ProofChunking {
        y0: miracl_g1_from_bytes(proof.first_move_y0.as_bytes())?,
        bb: proof.first_move_b[..]
            .iter()
            .map(|g1| miracl_g1_from_bytes(g1.as_bytes()))
            .collect::<Result<_, _>>()?,
        cc: proof.first_move_c[..]
            .iter()
            .map(|g1| miracl_g1_from_bytes(g1.as_bytes()))
            .collect::<Result<_, _>>()?,
        dd: proof.second_move_d[..]
            .iter()
            .map(|g1| miracl_g1_from_bytes(g1.as_bytes()))
            .collect::<Result<_, _>>()?,
        yy: miracl_g1_from_bytes(proof.second_move_y.as_bytes())?,
        z_r: proof
            .response_z_r
            .iter()
            .map(|fr| miracl_fr_from_bytes(fr.as_bytes()))
            .collect::<Result<_, _>>()?,
        z_s: proof.response_z_s[..]
            .iter()
            .map(|fr| miracl_fr_from_bytes(fr.as_bytes()))
            .collect::<Result<_, _>>()?,
        z_beta: miracl_fr_from_bytes(proof.response_z_b.as_bytes())?,
    };
    if chunking_proof.dd.len() != chunking_proof.z_r.len() + 1 {
        return Err(());
    }
    Ok(chunking_proof)
}
pub fn chunking_proof_into_miracl ( proof : & ZKProofDec ) -> Result < ProofChunking , ( ) > { // TODO: return type let chunking_proof = ProofChunking { y0 : miracl_g1_from_bytes ( proof . first_move_y0 . as_bytes ( ) ) ? , bb : proof . first_move_b [ .. ] . iter ( ) . map ( | g1 | miracl_g1_from_bytes ( g1 . as_bytes ( ) ) ) . collect :: < Result < _ , _ > > ( ) ? , cc : proof . first_move_c [ .. ] . iter ( ) . map ( | g1 | miracl_g1_from_bytes ( g1 . as_bytes ( ) ) ) . collect :: < Result < _ , _ > > ( ) ? , dd : proof . second_move_d [ .. ] . iter ( ) . map ( | g1 | miracl_g1_from_bytes ( g1 . as_bytes ( ) ) ) . collect :: < Result < _ , _ > > ( ) ? , yy : miracl_g1_from_bytes ( proof . second_move_y . as_bytes ( ) ) ? , z_r : proof . response_z_r . iter ( ) . map ( | fr | miracl_fr_from_bytes ( fr . as_bytes ( ) ) ) . collect :: < Result < _ , _ > > ( ) ? , z_s : proof . response_z_s [ .. ] . iter ( ) . map ( | fr | miracl_fr_from_bytes ( fr . as_bytes ( ) ) ) . collect :: < Result < _ , _ > > ( ) ? , z_beta : miracl_fr_from_bytes ( proof . response_z_b . as_bytes ( ) ) ? , } ; if chunking_proof . dd . len ( ) != chunking_proof . z_r . len ( ) + 1 { return Err ( ( ) ) ; } Ok ( chunking_proof ) }
Parses a chunking proof from the standard form into a miracl-compatible
type.
Parses a chunking proof from the standard form into a miracl - compatible type .
proof
&ZKProofDec
proof
&ZKProofDec
errors
This will return an error if any of the group elements is invalid.
This will return an error if any of the group elements is invalid .