Skip to content

Commit

Permalink
swap (pp)snark with zksnark, make pedersen zk, add nizk, update corre…
Browse files Browse the repository at this point in the history
…sp fns
  • Loading branch information
tyshkor committed Apr 23, 2024
1 parent 6d6d045 commit 1d82d8b
Show file tree
Hide file tree
Showing 17 changed files with 2,700 additions and 2,005 deletions.
10 changes: 7 additions & 3 deletions src/nifs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ use crate::{
traits::{commitment::CommitmentTrait, AbsorbInROTrait, Engine, ROConstants, ROTrait},
Commitment, CommitmentKey, CompressedCommitment,
};
use ff::Field;
use rand::rngs::OsRng;
use serde::{Deserialize, Serialize};

/// A SNARK that holds the proof of a step of an incremental computation
Expand Down Expand Up @@ -72,7 +74,8 @@ impl<E: Engine> NIFS<E> {
U2.absorb_in_ro(&mut ro);

// compute a commitment to the cross-term
let (T, comm_T) = S.commit_T(ck, U1, W1, U2, W2)?;
let r_T = E::Scalar::random(&mut OsRng);
let (T, comm_T) = S.commit_T(ck, U1, W1, U2, W2, &r_T)?;

// append `comm_T` to the transcript and obtain a challenge
comm_T.absorb_in_ro(&mut ro);
Expand All @@ -84,7 +87,7 @@ impl<E: Engine> NIFS<E> {
let U = U1.fold(U2, &comm_T, &r);

// fold the witness using `r` and `T`
let W = W1.fold(W2, &T, &r)?;
let W = W1.fold(W2, &T, &r_T, &r)?;

// return the folded instance and witness
Ok((
Expand Down Expand Up @@ -126,7 +129,8 @@ impl<E: Engine> NIFS<E> {
U2.absorb_in_ro(&mut ro);

// compute a commitment to the cross-term
let comm_T = S.commit_T_into(ck, U1, W1, U2, W2, T, ABC_Z_1, ABC_Z_2)?;
let r_T = E::Scalar::random(&mut OsRng);
let comm_T = S.commit_T_into(ck, U1, W1, U2, W2, T, ABC_Z_1, ABC_Z_2, &r_T)?;

// append `comm_T` to the transcript and obtain a challenge
comm_T.absorb_in_ro(&mut ro);
Expand Down
2 changes: 1 addition & 1 deletion src/provider/bn256_grumpkin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::{
};
use digest::{ExtendableOutput, Update};
use ff::{FromUniformBytes, PrimeField};
use group::{cofactor::CofactorCurveAffine, Curve, Group as AnotherGroup};
use group::{cofactor::CofactorCurveAffine, Curve, Group as AnotherGroup, GroupEncoding};
#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
use grumpkin_msm::{bn256 as bn256_msm, grumpkin as grumpkin_msm};
// Remove this when https://github.com/zcash/pasta_curves/issues/41 resolves
Expand Down
Loading

0 comments on commit 1d82d8b

Please sign in to comment.