Skip to content

Commit

Permalink
🚧 WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
taskooh committed Nov 7, 2023
1 parent c4a3747 commit 1e1f0fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 14 deletions.
14 changes: 3 additions & 11 deletions arkworks/algebra/poly/src/domain/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,10 @@ pub trait EvaluationDomain<F: FftField>:
type Elements: Iterator<Item = F> + Sized;

/// Sample an element that is *not* in the domain.
fn sample_element_outside_domain<R: Rng>(&self, rng: &mut R, public_rng: bool) -> F {
let mut t = if public_rng {
F::pub_rand(rng)
} else {
F::rand(rng)
};
fn sample_element_outside_domain<R: Rng>(&self, rng: &mut R) -> F {
let mut t = F::rand(rng);
while self.evaluate_vanishing_polynomial(t).is_zero() {
t = if public_rng {
F::pub_rand(rng)
} else {
F::rand(rng)
};
t = F::rand(rng);
}
t
}
Expand Down
2 changes: 1 addition & 1 deletion arkworks/groth16/src/generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ where

let domain_size = cs.num_constraints() + cs.num_instance_variables();
let domain = D::new(domain_size).ok_or(SynthesisError::PolynomialDegreeTooLarge)?;
let t = domain.sample_element_outside_domain(rng, false);
let t = domain.sample_element_outside_domain(rng);

end_timer!(domain_time);
///////////////////////////////////////////////////////////////////////////
Expand Down
4 changes: 2 additions & 2 deletions arkworks/marlin/src/ahp/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<F: PrimeField> AHPForR1CS<F> {
let domain_k = GeneralEvaluationDomain::new(index_info.num_non_zero)
.ok_or(SynthesisError::PolynomialDegreeTooLarge)?;

let alpha = domain_h.sample_element_outside_domain(rng, true);
let alpha = domain_h.sample_element_outside_domain(rng);
let eta_a = F::rand(rng);
let eta_b = F::rand(rng);
let eta_c = F::rand(rng);
Expand Down Expand Up @@ -83,7 +83,7 @@ impl<F: PrimeField> AHPForR1CS<F> {
mut state: VerifierState<F>,
rng: &mut R,
) -> (VerifierSecondMsg<F>, VerifierState<F>) {
let beta = state.domain_h.sample_element_outside_domain(rng, true);
let beta = state.domain_h.sample_element_outside_domain(rng);
let msg = VerifierSecondMsg { beta };
state.second_round_msg = Some(msg);

Expand Down

0 comments on commit 1e1f0fd

Please sign in to comment.