Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
iquerejeta committed Dec 12, 2024
1 parent dd00d8e commit 25ac945
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
6 changes: 2 additions & 4 deletions src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,14 +236,12 @@ pub(crate) fn powers<F: Field>(base: F) -> impl Iterator<Item = F> {
}

/// Multi scalar multiplication engine
pub trait MSM<C: PrimeCurveAffine>: Clone + Debug + Send + Sync {
pub trait MSM<C: PrimeCurveAffine>: Clone + Debug + Send + Sized + Sync {
/// Add arbitrary term (the scalar and the point)
fn append_term(&mut self, scalar: C::Scalar, point: C::Curve);

/// Add another multiexp into this one
fn add_msm(&mut self, other: &Self)
where
Self: Sized;
fn add_msm(&mut self, other: &Self);

/// Scale all scalars in the MSM by some scaling factor
fn scale(&mut self, factor: C::Scalar);
Expand Down
3 changes: 1 addition & 2 deletions src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,6 @@ where
let vanishing = vanishing.construct::<CS, T>(params, domain, h_poly, transcript)?;

let x: F = transcript.squeeze_challenge();
let xn = x.pow([params.n()]);

// Compute and hash advice evals for each circuit instance
for advice in advice.iter() {
Expand Down Expand Up @@ -512,7 +511,7 @@ where
transcript.write(eval)?;
}

let vanishing = vanishing.evaluate(x, xn, domain, transcript)?;
let vanishing = vanishing.evaluate(x, transcript)?;

// Evaluate common permutation data
pk.permutation.evaluate(x, transcript)?;
Expand Down
14 changes: 4 additions & 10 deletions src/plonk/vanishing/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,26 +125,20 @@ impl<F: PrimeField> Constructed<F> {
pub(in crate::plonk) fn evaluate<T: Transcript>(
self,
x: F,
_xn: F,
_domain: &EvaluationDomain<F>,
transcript: &mut T,
) -> Result<Evaluated<F>, Error>
where
F: Hashable<T::Hash> + SerdeObject,
{
self.h_pieces
.iter()
// .fold(domain.empty_coeff(), |acc, eval| acc * xn + eval);
.try_for_each(|p| {
let random_eval = eval_polynomial(p, x);
transcript.write(&random_eval)
})?;
self.h_pieces.iter().try_for_each(|p| {
let eval = eval_polynomial(p, x);
transcript.write(&eval)
})?;

let random_eval = eval_polynomial(&self.committed.random_poly, x);
transcript.write(&random_eval)?;

Ok(Evaluated {
// h_poly,
h_pieces: self.h_pieces,
committed: self.committed,
})
Expand Down

0 comments on commit 25ac945

Please sign in to comment.