mirror of
https://github.com/saymrwulf/pasta_curves-source.git
synced 2026-09-04 20:03:39 +00:00
Remove _x suffix from variable names
This commit is contained in:
parent
9099e9d9ba
commit
1b6c0e9a8b
3 changed files with 28 additions and 28 deletions
|
|
@ -41,9 +41,9 @@ pub struct SRS<C: CurveAffine> {
|
||||||
pub struct Proof<C: CurveAffine> {
|
pub struct Proof<C: CurveAffine> {
|
||||||
advice_commitments: Vec<C>,
|
advice_commitments: Vec<C>,
|
||||||
h_commitments: Vec<C>,
|
h_commitments: Vec<C>,
|
||||||
advice_evals_x: Vec<C::Scalar>,
|
advice_evals: Vec<C::Scalar>,
|
||||||
fixed_evals_x: Vec<C::Scalar>,
|
fixed_evals: Vec<C::Scalar>,
|
||||||
h_evals_x: Vec<C::Scalar>,
|
h_evals: Vec<C::Scalar>,
|
||||||
f_commitment: C,
|
f_commitment: C,
|
||||||
q_evals: Vec<C::Scalar>,
|
q_evals: Vec<C::Scalar>,
|
||||||
opening: OpeningProof<C>,
|
opening: OpeningProof<C>,
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
let x_3: C::Scalar = get_challenge_scalar(Challenge(transcript.squeeze().get_lower_128()));
|
let x_3: C::Scalar = get_challenge_scalar(Challenge(transcript.squeeze().get_lower_128()));
|
||||||
|
|
||||||
// Evaluate polynomials at omega^i x_3
|
// Evaluate polynomials at omega^i x_3
|
||||||
let advice_evals_x: Vec<_> = meta
|
let advice_evals: Vec<_> = meta
|
||||||
.advice_queries
|
.advice_queries
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&(wire, at)| {
|
.map(|&(wire, at)| {
|
||||||
|
|
@ -193,7 +193,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let fixed_evals_x: Vec<_> = meta
|
let fixed_evals: Vec<_> = meta
|
||||||
.fixed_queries
|
.fixed_queries
|
||||||
.iter()
|
.iter()
|
||||||
.map(|&(wire, at)| {
|
.map(|&(wire, at)| {
|
||||||
|
|
@ -208,7 +208,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let h_evals_x: Vec<_> = h_pieces
|
let h_evals: Vec<_> = h_pieces
|
||||||
.iter()
|
.iter()
|
||||||
.map(|poly| eval_polynomial(poly, x_3))
|
.map(|poly| eval_polynomial(poly, x_3))
|
||||||
.collect();
|
.collect();
|
||||||
|
|
@ -218,17 +218,17 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
let mut transcript_scalar = HScalar::init(C::Scalar::one());
|
let mut transcript_scalar = HScalar::init(C::Scalar::one());
|
||||||
|
|
||||||
// Hash each advice evaluation
|
// Hash each advice evaluation
|
||||||
for eval in advice_evals_x.iter() {
|
for eval in advice_evals.iter() {
|
||||||
transcript_scalar.absorb(*eval);
|
transcript_scalar.absorb(*eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash each fixed evaluation
|
// Hash each fixed evaluation
|
||||||
for eval in fixed_evals_x.iter() {
|
for eval in fixed_evals.iter() {
|
||||||
transcript_scalar.absorb(*eval);
|
transcript_scalar.absorb(*eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hash each h(x) piece evaluation
|
// Hash each h(x) piece evaluation
|
||||||
for eval in h_evals_x.iter() {
|
for eval in h_evals.iter() {
|
||||||
transcript_scalar.absorb(*eval);
|
transcript_scalar.absorb(*eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -250,7 +250,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
if q_polys[query_row].is_none() {
|
if q_polys[query_row].is_none() {
|
||||||
q_polys[query_row] = Some(advice_polys[wire.0].clone());
|
q_polys[query_row] = Some(advice_polys[wire.0].clone());
|
||||||
q_blinds[query_row] = advice_blinds[wire.0];
|
q_blinds[query_row] = advice_blinds[wire.0];
|
||||||
q_evals[query_row] = advice_evals_x[i];
|
q_evals[query_row] = advice_evals[i];
|
||||||
} else {
|
} else {
|
||||||
parallelize(q_polys[query_row].as_mut().unwrap(), |q, start| {
|
parallelize(q_polys[query_row].as_mut().unwrap(), |q, start| {
|
||||||
for (q, a) in q.iter_mut().zip(advice_polys[wire.0][start..].iter()) {
|
for (q, a) in q.iter_mut().zip(advice_polys[wire.0][start..].iter()) {
|
||||||
|
|
@ -261,7 +261,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
q_blinds[query_row] *= &x_4;
|
q_blinds[query_row] *= &x_4;
|
||||||
q_blinds[query_row] += &advice_blinds[wire.0];
|
q_blinds[query_row] += &advice_blinds[wire.0];
|
||||||
q_evals[query_row] *= &x_4;
|
q_evals[query_row] *= &x_4;
|
||||||
q_evals[query_row] += &advice_evals_x[i];
|
q_evals[query_row] += &advice_evals[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -271,7 +271,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
if q_polys[query_row].is_none() {
|
if q_polys[query_row].is_none() {
|
||||||
q_polys[query_row] = Some(srs.fixed_polys[wire.0].clone());
|
q_polys[query_row] = Some(srs.fixed_polys[wire.0].clone());
|
||||||
q_blinds[query_row] = C::Scalar::one();
|
q_blinds[query_row] = C::Scalar::one();
|
||||||
q_evals[query_row] = fixed_evals_x[i];
|
q_evals[query_row] = fixed_evals[i];
|
||||||
} else {
|
} else {
|
||||||
parallelize(q_polys[query_row].as_mut().unwrap(), |q, start| {
|
parallelize(q_polys[query_row].as_mut().unwrap(), |q, start| {
|
||||||
for (q, a) in q.iter_mut().zip(srs.fixed_polys[wire.0][start..].iter()) {
|
for (q, a) in q.iter_mut().zip(srs.fixed_polys[wire.0][start..].iter()) {
|
||||||
|
|
@ -282,14 +282,14 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
q_blinds[query_row] *= &x_4;
|
q_blinds[query_row] *= &x_4;
|
||||||
q_blinds[query_row] += &C::Scalar::one();
|
q_blinds[query_row] += &C::Scalar::one();
|
||||||
q_evals[query_row] *= &x_4;
|
q_evals[query_row] *= &x_4;
|
||||||
q_evals[query_row] += &fixed_evals_x[i];
|
q_evals[query_row] += &fixed_evals[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for ((h_poly, h_blind), h_eval) in h_pieces
|
for ((h_poly, h_blind), h_eval) in h_pieces
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.zip(h_blinds.iter())
|
.zip(h_blinds.iter())
|
||||||
.zip(h_evals_x.iter())
|
.zip(h_evals.iter())
|
||||||
{
|
{
|
||||||
// We query the h(X) polynomial at x_3
|
// We query the h(X) polynomial at x_3
|
||||||
let cur_row = *meta.query_rows.get(&0).unwrap();
|
let cur_row = *meta.query_rows.get(&0).unwrap();
|
||||||
|
|
@ -389,9 +389,9 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
Ok(Proof {
|
Ok(Proof {
|
||||||
advice_commitments,
|
advice_commitments,
|
||||||
h_commitments,
|
h_commitments,
|
||||||
advice_evals_x,
|
advice_evals,
|
||||||
fixed_evals_x,
|
fixed_evals,
|
||||||
h_evals_x,
|
h_evals,
|
||||||
f_commitment,
|
f_commitment,
|
||||||
q_evals,
|
q_evals,
|
||||||
opening,
|
opening,
|
||||||
|
|
|
||||||
|
|
@ -28,15 +28,15 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
|
|
||||||
let mut transcript_scalar = HScalar::init(C::Scalar::one());
|
let mut transcript_scalar = HScalar::init(C::Scalar::one());
|
||||||
|
|
||||||
for eval in self.advice_evals_x.iter() {
|
for eval in self.advice_evals.iter() {
|
||||||
transcript_scalar.absorb(*eval);
|
transcript_scalar.absorb(*eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
for eval in self.fixed_evals_x.iter() {
|
for eval in self.fixed_evals.iter() {
|
||||||
transcript_scalar.absorb(*eval);
|
transcript_scalar.absorb(*eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
for eval in &self.h_evals_x {
|
for eval in &self.h_evals {
|
||||||
transcript_scalar.absorb(*eval);
|
transcript_scalar.absorb(*eval);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -46,8 +46,8 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
h_eval *= &x_2;
|
h_eval *= &x_2;
|
||||||
|
|
||||||
let evaluation: C::Scalar = poly.evaluate(
|
let evaluation: C::Scalar = poly.evaluate(
|
||||||
&|index| self.fixed_evals_x[index],
|
&|index| self.fixed_evals[index],
|
||||||
&|index| self.advice_evals_x[index],
|
&|index| self.advice_evals[index],
|
||||||
&|a, b| a + &b,
|
&|a, b| a + &b,
|
||||||
&|a, b| a * &b,
|
&|a, b| a * &b,
|
||||||
&|a, scalar| a * &scalar,
|
&|a, scalar| a * &scalar,
|
||||||
|
|
@ -61,7 +61,7 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
// Compute the expected h(x) value
|
// Compute the expected h(x) value
|
||||||
let mut expected_h_eval = C::Scalar::zero();
|
let mut expected_h_eval = C::Scalar::zero();
|
||||||
let mut cur = C::Scalar::one();
|
let mut cur = C::Scalar::one();
|
||||||
for eval in &self.h_evals_x {
|
for eval in &self.h_evals {
|
||||||
expected_h_eval += &(cur * eval);
|
expected_h_eval += &(cur * eval);
|
||||||
cur *= &xn;
|
cur *= &xn;
|
||||||
}
|
}
|
||||||
|
|
@ -86,14 +86,14 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
if q_commitments[query_row].is_none() {
|
if q_commitments[query_row].is_none() {
|
||||||
q_commitments[query_row] =
|
q_commitments[query_row] =
|
||||||
Some(self.advice_commitments[wire.0].to_projective());
|
Some(self.advice_commitments[wire.0].to_projective());
|
||||||
q_evals[query_row] = self.advice_evals_x[i];
|
q_evals[query_row] = self.advice_evals[i];
|
||||||
} else {
|
} else {
|
||||||
q_commitments[query_row].as_mut().map(|commitment| {
|
q_commitments[query_row].as_mut().map(|commitment| {
|
||||||
*commitment *= x_4;
|
*commitment *= x_4;
|
||||||
*commitment += self.advice_commitments[wire.0];
|
*commitment += self.advice_commitments[wire.0];
|
||||||
});
|
});
|
||||||
q_evals[query_row] *= &x_4;
|
q_evals[query_row] *= &x_4;
|
||||||
q_evals[query_row] += &self.advice_evals_x[i];
|
q_evals[query_row] += &self.advice_evals[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -102,18 +102,18 @@ impl<C: CurveAffine> Proof<C> {
|
||||||
|
|
||||||
if q_commitments[query_row].is_none() {
|
if q_commitments[query_row].is_none() {
|
||||||
q_commitments[query_row] = Some(srs.fixed_commitments[wire.0].to_projective());
|
q_commitments[query_row] = Some(srs.fixed_commitments[wire.0].to_projective());
|
||||||
q_evals[query_row] = self.fixed_evals_x[i];
|
q_evals[query_row] = self.fixed_evals[i];
|
||||||
} else {
|
} else {
|
||||||
q_commitments[query_row].as_mut().map(|commitment| {
|
q_commitments[query_row].as_mut().map(|commitment| {
|
||||||
*commitment *= x_4;
|
*commitment *= x_4;
|
||||||
*commitment += srs.fixed_commitments[wire.0];
|
*commitment += srs.fixed_commitments[wire.0];
|
||||||
});
|
});
|
||||||
q_evals[query_row] *= &x_4;
|
q_evals[query_row] *= &x_4;
|
||||||
q_evals[query_row] += &self.fixed_evals_x[i];
|
q_evals[query_row] += &self.fixed_evals[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (h_commitment, h_eval) in self.h_commitments.iter().zip(self.h_evals_x.iter()) {
|
for (h_commitment, h_eval) in self.h_commitments.iter().zip(self.h_evals.iter()) {
|
||||||
// We query the h(X) polynomial at x_3
|
// We query the h(X) polynomial at x_3
|
||||||
let cur_row = *srs.meta.query_rows.get(&0).unwrap();
|
let cur_row = *srs.meta.query_rows.get(&0).unwrap();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue