pub fn prove(acir: Circuit, values: Vec<&FieldElement>) -> Vec<u8> {
    let num_vars = acir.num_vars() as usize;
    let num_constraints = compute_num_constraints(&acir);

    // The first variable is zero in Noir.
    // In PLONK there is no Variable::zero
    let values: Vec<_> = std::iter::once(&FieldElement::zero())
        .chain(values.into_iter())
        .copied()
        .map(|x| x.into_repr())
        .collect();

    let bn254_circ = serialise(acir, values);

    // XXX: This should not be used in production
    let rng = &mut ark_std::test_rng();

    let universal_srs = MarlinInst::universal_setup(num_constraints, num_vars, 100, rng).unwrap();

    let (index_pk, _) = MarlinInst::index(&universal_srs, bn254_circ.clone()).unwrap();

    let proof = MarlinInst::prove(&index_pk, bn254_circ, rng).unwrap();

    // Serialise proof
    let mut bytes = Vec::new();
    proof.serialize(&mut bytes).unwrap();
    bytes
}
// Creates a proof using the Marlin proving system
Creates a proof using the Marlin proving system
Creates a proof using the Marlin proving system
pub fn prove(acir: Circuit, values: Vec<&FieldElement>) -> Vec<u8> {
    let num_vars = acir.num_vars() as usize;
    let num_constraints = compute_num_constraints(&acir);
    // The first variable is zero in Noir.
    // In PLONK there is no Variable::zero
    let values: Vec<_> = std::iter::once(&FieldElement::zero())
        .chain(values.into_iter())
        .copied()
        .map(|x| x.into_repr())
        .collect();
    let bn254_circ = serialise(acir, values);
    // XXX: This should not be used in production
    let rng = &mut ark_std::test_rng();
    let universal_srs = MarlinInst::universal_setup(num_constraints, num_vars, 100, rng).unwrap();
    let (index_pk, _) = MarlinInst::index(&universal_srs, bn254_circ.clone()).unwrap();
    let proof = MarlinInst::prove(&index_pk, bn254_circ, rng).unwrap();
    // Serialise proof
    let mut bytes = Vec::new();
    proof.serialize(&mut bytes).unwrap();
    bytes
}
pub fn prove ( acir : Circuit , values : Vec < & FieldElement > ) -> Vec < u8 > { let num_vars = acir . num_vars ( ) as usize ; let num_constraints = compute_num_constraints ( & acir ) ; // The first variable is zero in Noir. // In PLONK there is no Variable::zero let values : Vec < _ > = std :: iter :: once ( & FieldElement :: zero ( ) ) . chain ( values . into_iter ( ) ) . copied ( ) . map ( | x | x . into_repr ( ) ) . collect ( ) ; let bn254_circ = serialise ( acir , values ) ; // XXX: This should not be used in production let rng = & mut ark_std :: test_rng ( ) ; let universal_srs = MarlinInst :: universal_setup ( num_constraints , num_vars , 100 , rng ) . unwrap ( ) ; let ( index_pk , _ ) = MarlinInst :: index ( & universal_srs , bn254_circ . clone ( ) ) . unwrap ( ) ; let proof = MarlinInst :: prove ( & index_pk , bn254_circ , rng ) . unwrap ( ) ; // Serialise proof let mut bytes = Vec :: new ( ) ; proof . serialize ( & mut bytes ) . unwrap ( ) ; bytes }
Creates a proof using the Marlin proving system
Creates a proof using the Marlin proving system
acir
Circuit
values
Vec<&FieldElement>
acir
Circuit
values
Vec<&FieldElement>