Skip to content

Commit

Permalink
fix: lint errors
Browse files Browse the repository at this point in the history
  • Loading branch information
lydiagarms committed Jan 6, 2025
1 parent 2fa3680 commit 8a72d56
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
10 changes: 5 additions & 5 deletions plonkish_backend/src/backend/hyperplonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ where
let mut witness_polys = Vec::with_capacity(pp.num_witness_polys.iter().sum());
let mut witness_comms = Vec::with_capacity(witness_polys.len());
let mut challenges = Vec::with_capacity(pp.num_challenges.iter().sum::<usize>() + 4);
// For each round, generate multi-linear polynomials from witness columns and commit
// For each round, generate multi-linear polynomials from witness columns and commit
for (round, (num_witness_polys, num_challenges)) in pp
.num_witness_polys
.iter()
Expand All @@ -162,7 +162,7 @@ where
// beta is used to compress the polynomials in the lookup argument
let beta = transcript.squeeze_challenge();

// Generate a compressed multilinear polynomial for each lookup in the vector of lookups
// Generate a compressed multilinear polynomial for each lookup in the vector of lookups
let timer = start_timer(|| format!("lookup_compressed_polys-{}", pp.lookups.len()));
let lookup_compressed_polys = {
let max_lookup_width = pp.lookups.iter().map(Vec::len).max().unwrap_or_default();
Expand Down Expand Up @@ -218,7 +218,7 @@ where
]
.collect_vec();
challenges.extend([beta, gamma, alpha]);
// Prove the zero check is satisfied for the expression wrt the polynomials
// Prove the zero check is satisfied for the expression wrt the polynomials
let (points, evals) = prove_zero_check(
pp.num_instances.len(),
&pp.expression,
Expand All @@ -241,7 +241,7 @@ where
]
.collect_vec();
let timer = start_timer(|| format!("pcs_batch_open-{}", evals.len()));
// Open all polynomials at the points from the zero check and give the opening proofs
// Open all polynomials at the points from the zero check and give the opening proofs
Pcs::batch_open(&pp.pcs, polys, comms, &points, &evals, transcript)?;
end_timer(timer);
// Proof is saved in transcript
Expand Down Expand Up @@ -298,7 +298,7 @@ where
let y = transcript.squeeze_challenges(vp.num_vars);

challenges.extend([beta, gamma, alpha]);
// Verify the zero check for the constraints defined in the expression
// Verify the zero check for the constraints defined in the expression
let (points, evals) = verify_zero_check(
vp.num_vars,
&vp.expression,
Expand Down
18 changes: 9 additions & 9 deletions plonkish_backend/src/backend/hyperplonk/preprocessor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub(crate) fn preprocess<F: PrimeField, Pcs: PolynomialCommitmentScheme<F>>(

let num_vars = circuit_info.k;
let poly_size = 1 << num_vars;
// Batch size for the polynomial commitment scheme
// Batch size for the polynomial commitment scheme
let batch_size = batch_size(circuit_info);
// Trim the parameters for the PCS to those necessary for the size of the circuit
let (pcs_pp, pcs_vp) = Pcs::trim(param, poly_size, batch_size)?;
Expand Down Expand Up @@ -171,7 +171,7 @@ pub(super) fn max_degree<F: PrimeField>(
.unwrap()
}

//generate lookup constraints using logup GKR
//generate lookup constraints using logup GKR
pub(super) fn lookup_constraints<F: PrimeField>(
circuit_info: &PlonkishCircuitInfo<F>,
beta: &Expression<F>,
Expand Down Expand Up @@ -202,7 +202,7 @@ pub(super) fn lookup_constraints<F: PrimeField>(
[h * (input + gamma) * (table + gamma) - (table + gamma) + m * (input + gamma)]
})
.collect_vec();
// Every expression that must be proved in the sum check argument
// Every expression that must be proved in the sum check argument
let sum_check = (h_offset..)
.take(circuit_info.lookups.len())
.map(|h| Query::new(h, Rotation::cur()).into())
Expand All @@ -226,7 +226,7 @@ pub(crate) fn permutation_constraints<F: PrimeField>(
// The offset is set to the total number of instance columns in the circuit
let permutation_offset = circuit_info.num_poly();
let z_offset = permutation_offset + permutation_polys.len() + num_builtin_witness_polys;
// Represent all columns in permutation argument with polynomials
// Represent all columns in permutation argument with polynomials
let polys = permutation_polys
.iter()
.map(|idx| Expression::Polynomial(Query::new(*idx, Rotation::cur())))
Expand All @@ -252,12 +252,12 @@ pub(crate) fn permutation_constraints<F: PrimeField>(
let z_0_next = Expression::<F>::Polynomial(Query::new(z_offset, Rotation::next()));
let l_0 = &Expression::<F>::lagrange(0);
let one = &Expression::one();
// Create the constraints for the permutation argument
// Create the constraints for the permutation argument
// The contraints here are the like those from the halo2 gitbook but the matrix Z_0 Z_1 ... Z_{b-1} is transposed
let constraints = chain![
zs.first().map(|z_0| l_0 * (z_0 - one)),
polys
//iterating over b elements which are vectors of length m
//iterating over b elements which are vectors of length m
.chunks(chunk_size)
.zip(ids.chunks(chunk_size))
.zip(permutations.chunks(chunk_size))
Expand All @@ -284,7 +284,7 @@ pub(crate) fn permutation_constraints<F: PrimeField>(
(num_chunks, constraints)
}

// Generate multi-linear permutation polynomials for permutation argument
// Generate multi-linear permutation polynomials for permutation argument
pub(crate) fn permutation_polys<F: PrimeField>(
num_vars: usize,
permutation_polys: &[usize],
Expand All @@ -298,7 +298,7 @@ pub(crate) fn permutation_polys<F: PrimeField>(
}
poly_index
};
// permutations will be the matrix defining all permutation polynomials. As we start with the identity permutation, all entries have value of the index within the matrix.
// permutations will be the matrix defining all permutation polynomials. As we start with the identity permutation, all entries have value of the index within the matrix.
let mut permutations = (0..permutation_polys.len() as u64)
.map(|idx| {
steps(F::from(idx << num_vars))
Expand All @@ -314,7 +314,7 @@ pub(crate) fn permutation_polys<F: PrimeField>(
mem::swap(&mut permutations[poly_index[i]][j], &mut last);
}
}
// We generate a multilinear polynomial from each column of the permutation matrix.
// We generate a multilinear polynomial from each column of the permutation matrix.
permutations
.into_iter()
.map(MultilinearPolynomial::new)
Expand Down
4 changes: 2 additions & 2 deletions plonkish_backend/src/backend/hyperplonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ pub(crate) fn lookup_compressed_polys<F: PrimeField, R: Rotatable + From<usize>>

let polys = polys.iter().map(Borrow::borrow).collect_vec();
let num_vars = polys[0].num_vars();
// This is the sum of all elements in the input and table
// This is the sum of all elements in the input and table
let expression = lookups
.iter()
.flat_map(|lookup| lookup.iter().map(|(input, table)| (input + table)))
Expand Down Expand Up @@ -173,7 +173,7 @@ pub(super) fn lookup_m_poly<F: PrimeField + Hash>(
.and_modify(|count| *count += 1)
.or_insert(1);
} else {
// If the input is not found in the table, the lookup is invalid
// If the input is not found in the table, the lookup is invalid
*valid = false;
break;
}
Expand Down
4 changes: 2 additions & 2 deletions plonkish_backend/src/backend/hyperplonk/verifier.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ pub(crate) fn verify_sum_check<F: PrimeField>(
y: &[F],
transcript: &mut impl FieldTranscriptRead<F>,
) -> Result<(Vec<Vec<F>>, Vec<Evaluation<F>>), Error> {
// In description of the sum check protocol in https://eprint.iacr.org/2022/1355.pdf,
// In description of the sum check protocol in https://eprint.iacr.org/2022/1355.pdf,
// x_eval corresponds to the v in the final check, x is \alpha_1, ..., \alpha_{\mu} the challenges during the sum check protocol
let (x_eval, x) = ClassicSumCheck::<EvaluationsProver<_>, BinaryField>::verify(
&(),
Expand Down Expand Up @@ -82,7 +82,7 @@ pub(crate) fn verify_sum_check<F: PrimeField>(
));
}

// Obtain points and evaluations for which we need to verify the opening proofs
// Obtain points and evaluations for which we need to verify the opening proofs
let point_offset = point_offset(&pcs_query);
let evals = pcs_query
.iter()
Expand Down
16 changes: 8 additions & 8 deletions plonkish_backend/src/circuits/poseidongadget/poseidon/pow5.rs
Original file line number Diff line number Diff line change
Expand Up @@ -588,13 +588,13 @@ impl<F: Field, const WIDTH: usize> Pow5State<F, WIDTH> {
mod tests {
use group::ff::{Field, PrimeField};
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner, Value},
circuit::{Layouter,SimpleFloorPlanner,Value},
dev::MockProver,
plonk::{Circuit, ConstraintSystem, Error,keygen_vk,keygen_pk,create_proof,verify_proof},
poly::kzg::{commitment::{KZGCommitmentScheme,ParamsKZG},multiopen::{ProverGWC, VerifierGWC},strategy::SingleStrategy,},
transcript::{Blake2bRead, Blake2bWrite, Challenge255, TranscriptReadBuffer, TranscriptWriterBuffer},
poly::kzg::{commitment::{KZGCommitmentScheme,ParamsKZG},multiopen::{ProverGWC,VerifierGWC},strategy::SingleStrategy,},
transcript::{Blake2bRead,Blake2bWrite,Challenge255,TranscriptReadBuffer,TranscriptWriterBuffer},
};
use halo2_curves::pasta::{pallas, Fp};
use halo2_curves::pasta::{pallas,Fp};
use halo2_curves::bn256::{Bn256,Fr,Fq};
use halo2_curves::grumpkin;
use rand::rngs::OsRng;
Expand Down Expand Up @@ -725,10 +725,10 @@ mod tests {

fn instances(&self) -> Vec<Vec<Fr>> {
/*let mut expected_final_state = (0..7)
.map(|idx| Fq::from(idx as u64))
.collect::<Vec<_>>()
.try_into()
.unwrap();*/
.map(|idx| Fq::from(idx as u64))
.collect::<Vec<_>>()
.try_into()
.unwrap();*/
Vec::new()
}
}
Expand Down

0 comments on commit 8a72d56

Please sign in to comment.