Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return ZK #380

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add support for supernova
tyshkor committed Apr 25, 2024
commit 98fc7c8ff26cd164d692d4d1c1c07647c508c530
13 changes: 9 additions & 4 deletions src/cyclefold/nifs.rs
Original file line number Diff line number Diff line change
@@ -2,6 +2,9 @@

use std::marker::PhantomData;

use rand_core::OsRng;
use ff::Field;

use crate::{
constants::{NIO_CYCLE_FOLD, NUM_CHALLENGE_BITS, NUM_FE_IN_EMULATED_POINT},
errors::NovaError,
@@ -66,15 +69,16 @@ where

absorb_primary_r1cs::<E1, E2>(U2, &mut ro);

let (T, comm_T) = S.commit_T(ck, U1, W1, U2, W2)?;
let r_T = E1::Scalar::random(&mut OsRng);
let (T, comm_T) = S.commit_T(ck, U1, W1, U2, W2, &r_T)?;

absorb_primary_commitment::<E1, E2>(&comm_T, &mut ro);

let r = scalar_as_base::<E2>(ro.squeeze(NUM_CHALLENGE_BITS));

let U = U1.fold(U2, &comm_T, &r);

let W = W1.fold(W2, &T, &r)?;
let W = W1.fold(W2, &T, &r_T, &r)?;

Ok((
Self {
@@ -131,7 +135,8 @@ impl<E: Engine> CycleFoldNIFS<E> {
absorb_cyclefold_r1cs(U2, &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);
@@ -143,7 +148,7 @@ impl<E: Engine> CycleFoldNIFS<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((
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -25,8 +25,8 @@ pub mod r1cs;
pub mod spartan;
pub mod traits;

// pub mod cyclefold;
// pub mod supernova;
pub mod cyclefold;
pub mod supernova;

use once_cell::sync::OnceCell;
use traits::{CurveCycleEquipped, Dual};