Skip to content

Commit b6b9da2

Browse files
committed
Address witness blinding review nits
1 parent 07800a5 commit b6b9da2

4 files changed

Lines changed: 5 additions & 8 deletions

File tree

src/frontend/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ mod tests {
4040
traits::{snark::default_ck_hint, Engine},
4141
};
4242
use ff::{Field, PrimeField};
43+
use rand_core::OsRng;
4344

4445
fn synthesize_alloc_bit<Fr: PrimeField, CS: ConstraintSystem<Fr>>(cs: &mut CS) {
4546
// get two bits as input and check that they are indeed bits
@@ -72,7 +73,7 @@ mod tests {
7273
let mut cs = SatisfyingAssignment::<E>::new();
7374
synthesize_alloc_bit(&mut cs);
7475
let (inst, witness) = cs
75-
.r1cs_instance_and_witness(&shape, &ck, E::Scalar::ZERO)
76+
.r1cs_instance_and_witness(&shape, &ck, E::Scalar::random(&mut OsRng))
7677
.unwrap();
7778

7879
// Make sure that this is satisfiable

src/frontend/r1cs.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ pub trait NovaWitness<E: Engine> {
1414
/// Return an instance and witness, given a shape, commitment key, and blind.
1515
///
1616
/// Hiding commitments require a uniformly random, secret, single-use blind.
17-
/// Protocols that explicitly derandomize a commitment may instead reveal
18-
/// the blind as part of the proof.
1917
fn r1cs_instance_and_witness(
2018
&self,
2119
shape: &R1CSShape<E>,

src/gadgets/ecc.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1288,7 +1288,7 @@ mod tests {
12881288
let mut cs = SatisfyingAssignment::<E2>::new();
12891289
let (a, e, s) = synthesize_smul::<E1, _>(cs.namespace(|| "synthesize"));
12901290
let (inst, witness) = cs
1291-
.r1cs_instance_and_witness(&shape, &ck, E2::Scalar::ZERO)
1291+
.r1cs_instance_and_witness(&shape, &ck, E2::Scalar::random(&mut OsRng))
12921292
.unwrap();
12931293

12941294
let a_p: Point<E1> = Point::new(
@@ -1347,7 +1347,7 @@ mod tests {
13471347
let mut cs = SatisfyingAssignment::<E2>::new();
13481348
let (a, e) = synthesize_add_equal::<E1, _>(cs.namespace(|| "synthesize add equal"));
13491349
let (inst, witness) = cs
1350-
.r1cs_instance_and_witness(&shape, &ck, E2::Scalar::ZERO)
1350+
.r1cs_instance_and_witness(&shape, &ck, E2::Scalar::random(&mut OsRng))
13511351
.unwrap();
13521352
let a_p: Point<E1> = Point::new(
13531353
a.x.get_value().unwrap(),
@@ -1410,7 +1410,7 @@ mod tests {
14101410
let mut cs = SatisfyingAssignment::<E2>::new();
14111411
let e = synthesize_add_negation::<E1, _>(cs.namespace(|| "synthesize add negation"));
14121412
let (inst, witness) = cs
1413-
.r1cs_instance_and_witness(&shape, &ck, E2::Scalar::ZERO)
1413+
.r1cs_instance_and_witness(&shape, &ck, E2::Scalar::random(&mut OsRng))
14141414
.unwrap();
14151415
let e_p: Point<E1> = Point::new(
14161416
e.x.get_value().unwrap(),

src/r1cs/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -808,8 +808,6 @@ impl<E: Engine> R1CSWitness<E> {
808808
/// Creates a witness using a caller-supplied commitment blinding factor.
809809
///
810810
/// Hiding commitments require a uniformly random, secret, single-use blind.
811-
/// Protocols that explicitly derandomize a commitment may instead reveal
812-
/// the blind as part of the proof.
813811
pub fn new(
814812
S: &R1CSShape<E>,
815813
W: &[E::Scalar],

0 commit comments

Comments
 (0)