Browse Source

migrate codebase to arkworks and change curve to bls12-377

master
Mara Mihali 1 year ago
parent
commit
b085c670be
7 changed files with 17 additions and 5 deletions
  1. +2
    -0
      examples/cubic.rs
  2. +6
    -1
      src/group.rs
  3. +1
    -1
      src/lib.rs
  4. +2
    -0
      src/nizk/bullet.rs
  5. +2
    -0
      src/nizk/mod.rs
  6. +3
    -3
      src/r1csinstance.rs
  7. +1
    -0
      src/sumcheck.rs

+ 2
- 0
examples/cubic.rs

@ -8,6 +8,8 @@
//! `(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;

+ 6
- 1
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};

+ 1
- 1
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 @@ pub type VarsAssignment = Assignment;
/// `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 {

+ 2
- 0
src/nizk/bullet.rs

@ -3,6 +3,8 @@
#![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,

+ 2
- 0
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::{

+ 3
- 3
src/r1csinstance.rs

@ -147,9 +147,9 @@ impl R1CSInstance {
}
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(

+ 1
- 0
src/sumcheck.rs

@ -829,6 +829,7 @@ impl ZKSumcheckInstanceProof {
// 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);

Loading…
Cancel
Save