Skip to content

Commit

Permalink
Make 'hiding=true' the default
Browse files Browse the repository at this point in the history
  • Loading branch information
davxy committed Aug 20, 2024
1 parent 6754aa4 commit b20f243
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
18 changes: 12 additions & 6 deletions common/src/domain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,7 @@ pub struct Domain<F: FftField> {

impl<F: FftField> Domain<F> {
/// Construct a new evaluation domain.
///
/// `hiding` parameter determines whether we wish to produce a zk-PROOF or not.
/// This parameter is only relevant for the prover.
pub fn new(n: usize, hiding: bool) -> Self {
pub fn new(n: usize) -> Self {
let domains = Domains::new(n);
let size = domains.x1.size();
let capacity = size - ZK_ROWS;
Expand All @@ -76,7 +73,7 @@ impl<F: FftField> Domain<F> {

Self {
domains,
hiding,
hiding: true,
capacity,
not_last_row,
l_first,
Expand All @@ -85,6 +82,15 @@ impl<F: FftField> Domain<F> {
}
}

/// Set whether we wish to produce a zk-PROOF or not.
///
/// Defaults to `true` and this is only relevant for the prover.
pub fn hiding(mut self, value: bool) -> Self {
self.hiding = value;
self
}


pub(crate) fn divide_by_vanishing_poly<>(
&self,
poly: &DensePolynomial<F>,
Expand Down Expand Up @@ -228,7 +234,7 @@ mod tests {

// let domain = GeneralEvaluationDomain::new(1024);
let n = 1024;
let domain = Domain::new(n, hiding);
let domain = Domain::new(n).hiding(hiding);
let z = Fq::rand(rng);
let domain_eval = EvaluatedDomain::new(domain.domain(), z);
assert_eq!(domain.l_first.poly.evaluate(&z), domain_eval.l_first);
Expand Down
4 changes: 2 additions & 2 deletions common/src/gadgets/inner_prod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ mod tests {

let log_n = 10;
let n = 2usize.pow(log_n);
let domain = Domain::new(n, hiding);
let domain = Domain::new(n).hiding(hiding);

let a = random_vec(domain.capacity - 1, rng);
let b = random_vec(domain.capacity - 1, rng);
Expand All @@ -130,4 +130,4 @@ mod tests {
_test_inner_prod_gadget(false);
_test_inner_prod_gadget(true);
}
}
}
2 changes: 1 addition & 1 deletion common/src/gadgets/sw_cond_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ mod tests {

let log_n = 10;
let n = 2usize.pow(log_n);
let domain = Domain::new(n, hiding);
let domain = Domain::new(n).hiding(hiding);
let seed = SWAffine::generator();

let bitmask = random_bitvec(domain.capacity - 1, 0.5, rng);
Expand Down
2 changes: 1 addition & 1 deletion ring/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ mod tests {
let setup_degree = 3 * domain_size;
let pcs_params = CS::setup(setup_degree, rng);

let domain = Domain::new(domain_size, true);
let domain = Domain::new(domain_size);
let h = SWAffine::rand(rng);
let seed = find_complement_point::<BandersnatchConfig>();
let piop_params = PiopParams::setup(domain, h, seed);
Expand Down
2 changes: 1 addition & 1 deletion ring/src/piop/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ mod tests {
let rng = &mut test_rng();
let h = SWAffine::rand(rng);
let seed = SWAffine::rand(rng);
let domain = Domain::new(1024, false);
let domain = Domain::new(1024).hiding(false);
let params = PiopParams::<Fq, BandersnatchConfig>::setup(domain, h, seed);
let t = Fr::rand(rng);
let t_bits = params.scalar_part(t);
Expand Down
4 changes: 2 additions & 2 deletions ring/src/ring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ mod tests {
// piop params
let h = SWAffine::rand(rng);
let seed = SWAffine::rand(rng);
let domain = Domain::new(domain_size, true);
let domain = Domain::new(domain_size);
let piop_params = PiopParams::setup(domain, h, seed);

let mut ring = TestRing::empty(&piop_params, srs, ring_builder_key.g1);
Expand Down Expand Up @@ -290,7 +290,7 @@ mod tests {
// piop params
let h = SWAffine::rand(rng);
let seed = SWAffine::rand(rng);
let domain = Domain::new(domain_size, true);
let domain = Domain::new(domain_size);
let piop_params = PiopParams::setup(domain, h, seed);

let ring = TestRing::empty(&piop_params, srs, ring_builder_key.g1);
Expand Down

0 comments on commit b20f243

Please sign in to comment.