Skip to content

Commit 98fc7c8

Browse files
committed
add support for supernova
1 parent 1d82d8b commit 98fc7c8

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/cyclefold/nifs.rs

+9-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
33
use std::marker::PhantomData;
44

5+
use rand_core::OsRng;
6+
use ff::Field;
7+
58
use crate::{
69
constants::{NIO_CYCLE_FOLD, NUM_CHALLENGE_BITS, NUM_FE_IN_EMULATED_POINT},
710
errors::NovaError,
@@ -66,15 +69,16 @@ where
6669

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

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

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

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

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

77-
let W = W1.fold(W2, &T, &r)?;
81+
let W = W1.fold(W2, &T, &r_T, &r)?;
7882

7983
Ok((
8084
Self {
@@ -131,7 +135,8 @@ impl<E: Engine> CycleFoldNIFS<E> {
131135
absorb_cyclefold_r1cs(U2, &mut ro);
132136

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

136141
// append `comm_T` to the transcript and obtain a challenge
137142
comm_T.absorb_in_ro(&mut ro);
@@ -143,7 +148,7 @@ impl<E: Engine> CycleFoldNIFS<E> {
143148
let U = U1.fold(U2, &comm_T, &r);
144149

145150
// fold the witness using `r` and `T`
146-
let W = W1.fold(W2, &T, &r)?;
151+
let W = W1.fold(W2, &T, &r_T, &r)?;
147152

148153
// return the folded instance and witness
149154
Ok((

src/lib.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ pub mod r1cs;
2525
pub mod spartan;
2626
pub mod traits;
2727

28-
// pub mod cyclefold;
29-
// pub mod supernova;
28+
pub mod cyclefold;
29+
pub mod supernova;
3030

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

0 commit comments

Comments
 (0)