migrate codebase to arkworks and change curve to bls12-377
Mara Mihali maramihali@google.com
Fri, 17 Jun 2022 12:28:11 +0100
7 files changed,
17 insertions(+),
5 deletions(-)
M
examples/cubic.rs
→
examples/cubic.rs
@@ -8,6 +8,8 @@ //! `(Z2 + Z0) * 1 - Z3 = 0`
//! `(Z3 + 5) * 1 - I0 = 0` //! //! [here]: https://medium.com/@VitalikButerin/quadratic-arithmetic-programs-from-zero-to-hero-f6d558cea649 +use ark_bls12_377::Fr as Scalar; +use ark_ff::{BigInteger, PrimeField}; use ark_std::{One, UniformRand, Zero}; use libspartan::{InputsAssignment, Instance, SNARKGens, VarsAssignment, SNARK}; use merlin::Transcript;
M
src/group.rs
→
src/group.rs
@@ -7,7 +7,12 @@ use lazy_static::lazy_static;
use num_bigint::BigInt; use crate::errors::ProofVerifyError; -use super::scalar::{Scalar}; +use lazy_static::lazy_static; +use num_bigint::BigInt; + +use super::scalar::Scalar; +use ark_ec::{AffineCurve, ProjectiveCurve}; +use ark_serialize::*; use core::borrow::Borrow; use core::ops::{Mul, MulAssign}; use ark_ec::{ProjectiveCurve, AffineCurve};
M
src/lib.rs
→
src/lib.rs
@@ -1,6 +1,7 @@
#![allow(non_snake_case)] #![doc = include_str!("../README.md")] #![deny(missing_docs)] +#![feature(test)] #![allow(clippy::assertions_on_result_states)] extern crate ark_std;@@ -120,7 +121,6 @@
/// `InputsAssignment` holds an assignment of values to variables in an `Instance` pub type InputsAssignment = Assignment; -/// `Instance` holds the description of R1CS matrices /// `Instance` holds the description of R1CS matrices and a hash of the matrices #[derive(Debug)] pub struct Instance {
M
src/nizk/bullet.rs
→
src/nizk/bullet.rs
@@ -3,6 +3,8 @@ //! See NOTICE.md for more details
#![allow(non_snake_case)] #![allow(clippy::type_complexity)] #![allow(clippy::too_many_arguments)] +use crate::math::Math; + use super::super::errors::ProofVerifyError; use super::super::group::{ CompressGroupElement, CompressedGroup, DecompressGroupElement, GroupElement,
M
src/nizk/mod.rs
→
src/nizk/mod.rs
@@ -1,4 +1,6 @@
#![allow(clippy::too_many_arguments)] +use crate::math::Math; + use super::commitments::{Commitments, MultiCommitGens}; use super::errors::ProofVerifyError; use super::group::{
M
src/r1csinstance.rs
→
src/r1csinstance.rs
@@ -147,9 +147,9 @@ self.num_inputs
} pub fn get_digest(&self) -> Vec<u8> { - let mut encoder = ZlibEncoder::new(Vec::new(), Compression::default()); - bincode::serialize_into(&mut encoder, &self).unwrap(); - encoder.finish().unwrap() + let mut bytes = Vec::new(); + self.serialize(&mut bytes).unwrap(); + bytes } pub fn produce_synthetic_r1cs(
M
src/sumcheck.rs
→
src/sumcheck.rs
@@ -829,6 +829,7 @@
// add two claims to transcript comm_claim_per_round.append_to_transcript(b"comm_claim_per_round", transcript); comm_eval.append_to_transcript(b"comm_eval", transcript); + // produce two weights let w = transcript.challenge_vector(b"combine_two_claims_to_one", 2);