Remove the "endo_r" & "endo_q" fields from SRS struct since irrelevant
MODIFY
poly-commitment/src/commitment.rs
poly-commitment/src/commitment.rs
//! producing the batched opening proof
//! 3. Verify batch of batched opening proofs
+use crate::srs::endos;
use crate::{error::CommitmentError, srs::SRS};
use ark_ec::{
models::short_weierstrass_jacobian::GroupAffine as SWJAffine, msm::VariableBaseMSM,
@@ -692,6 +693,8 @@ impl<G: CommitmentCurve> SRS<G> {
let padded_length = 1 << max_rounds;
+ let (_, endo_r) = endos::<G>();
+
// TODO: This will need adjusting
let padding = padded_length - nonzero_length;
let mut points = vec![self.h];
@@ -748,11 +751,10 @@ impl<G: CommitmentCurve> SRS<G> {
let t = sponge.challenge_fq();
let u: G = to_group(group_map, t);
- let Challenges { chal, chal_inv } =
- opening.challenges::<EFqSponge>(&self.endo_r, sponge);
+ let Challenges { chal, chal_inv } = opening.challenges::<EFqSponge>(&endo_r, sponge);
sponge.absorb_g(&[opening.delta]);
- let c = ScalarChallenge(sponge.challenge()).to_field(&self.endo_r);
+ let c = ScalarChallenge(sponge.challenge()).to_field(&endo_r);
// < s, sum_i evalscale^i pows(evaluation_point[i]) >
// ==

MODIFY
poly-commitment/src/evaluation_proof.rs
poly-commitment/src/evaluation_proof.rs
-use crate::commitment::*;
use crate::srs::SRS;
+use crate::{commitment::*, srs::endos};
use ark_ec::{msm::VariableBaseMSM, AffineCurve, ProjectiveCurve};
use ark_ff::{Field, One, PrimeField, UniformRand, Zero};
use ark_poly::{univariate::DensePolynomial, UVPolynomial};
@@ -96,6 +96,8 @@ impl<G: CommitmentCurve> SRS<G> {
RNG: RngCore + CryptoRng,
G::BaseField: PrimeField,
{
+ let (endo_q, endo_r) = endos::<G>();
+
let rounds = math::ceil_log2(self.g.len());
let padded_length = 1 << rounds;
@@ -223,7 +225,7 @@ impl<G: CommitmentCurve> SRS<G> {
sponge.absorb_g(&[r]);
let u_pre = squeeze_prechallenge(&mut sponge);
- let u = u_pre.to_field(&self.endo_r);
+ let u = u_pre.to_field(&endo_r);
let u_inv = u.inverse().unwrap();
chals.push(u);
@@ -253,7 +255,7 @@ impl<G: CommitmentCurve> SRS<G> {
})
.collect();
- g = G::combine_one_endo(self.endo_r, self.endo_q, &g_lo, &g_hi, u_pre);
+ g = G::combine_one_endo(endo_r, endo_q, &g_lo, &g_hi, u_pre);
}
assert!(g.len() == 1);
@@ -275,7 +277,7 @@ impl<G: CommitmentCurve> SRS<G> {
.into_affine();
sponge.absorb_g(&[delta]);
- let c = ScalarChallenge(sponge.challenge()).to_field(&self.endo_r);
+ let c = ScalarChallenge(sponge.challenge()).to_field(&endo_r);
let z1 = a0 * c + d;
let z2 = c * r_prime + r_delta;

MODIFY
poly-commitment/src/srs.rs
poly-commitment/src/srs.rs
@@ -27,12 +27,6 @@ pub struct SRS<G: CommitmentCurve> {
/// Commitments to Lagrange bases, per domain size
#[serde(skip)]
pub lagrange_bases: HashMap<usize, Vec<PolyComm<G>>>,
- /// Coefficient for the curve endomorphism
- #[serde(skip)]
- pub endo_r: G::ScalarField,
- /// Coefficient for the curve endomorphism
- #[serde(skip)]
- pub endo_q: G::BaseField,
}
pub fn endos<G: CommitmentCurve>() -> (G::BaseField, G::ScalarField)
@@ -228,8 +222,6 @@ where
})
.collect();
- let (endo_q, endo_r) = endos::<G>();
-
const MISC: usize = 1;
let [h]: [G; MISC] = array::from_fn(|i| {
let mut h = Blake2b512::new();
@@ -242,8 +234,6 @@ where
g,
h,
lagrange_bases: HashMap::new(),
- endo_r,
- endo_q,
}
}
}

Remove the "endo_r" & "endo_q" fields from SRS struct since irrelevant