diff --git a/plonkish_backend/src/backend/hyperplonk.rs b/plonkish_backend/src/backend/hyperplonk.rs index 48c8296..7b274c1 100644 --- a/plonkish_backend/src/backend/hyperplonk.rs +++ b/plonkish_backend/src/backend/hyperplonk.rs @@ -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::() + 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() @@ -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(); @@ -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, @@ -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 @@ -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, diff --git a/plonkish_backend/src/backend/hyperplonk/preprocessor.rs b/plonkish_backend/src/backend/hyperplonk/preprocessor.rs index 6aa7bc0..d0b094b 100644 --- a/plonkish_backend/src/backend/hyperplonk/preprocessor.rs +++ b/plonkish_backend/src/backend/hyperplonk/preprocessor.rs @@ -46,7 +46,7 @@ pub(crate) fn preprocess>( 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)?; @@ -171,7 +171,7 @@ pub(super) fn max_degree( .unwrap() } -//generate lookup constraints using logup GKR +//generate lookup constraints using logup GKR pub(super) fn lookup_constraints( circuit_info: &PlonkishCircuitInfo, beta: &Expression, @@ -202,7 +202,7 @@ pub(super) fn lookup_constraints( [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()) @@ -226,7 +226,7 @@ pub(crate) fn permutation_constraints( // 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()))) @@ -252,12 +252,12 @@ pub(crate) fn permutation_constraints( let z_0_next = Expression::::Polynomial(Query::new(z_offset, Rotation::next())); let l_0 = &Expression::::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)) @@ -284,7 +284,7 @@ pub(crate) fn permutation_constraints( (num_chunks, constraints) } -// Generate multi-linear permutation polynomials for permutation argument +// Generate multi-linear permutation polynomials for permutation argument pub(crate) fn permutation_polys( num_vars: usize, permutation_polys: &[usize], @@ -298,7 +298,7 @@ pub(crate) fn permutation_polys( } 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)) @@ -314,7 +314,7 @@ pub(crate) fn permutation_polys( 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) diff --git a/plonkish_backend/src/backend/hyperplonk/prover.rs b/plonkish_backend/src/backend/hyperplonk/prover.rs index 52fd446..f74f6e9 100644 --- a/plonkish_backend/src/backend/hyperplonk/prover.rs +++ b/plonkish_backend/src/backend/hyperplonk/prover.rs @@ -57,7 +57,7 @@ pub(crate) fn lookup_compressed_polys> 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))) @@ -173,7 +173,7 @@ pub(super) fn lookup_m_poly( .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; } diff --git a/plonkish_backend/src/backend/hyperplonk/verifier.rs b/plonkish_backend/src/backend/hyperplonk/verifier.rs index d730b2c..f9f6049 100644 --- a/plonkish_backend/src/backend/hyperplonk/verifier.rs +++ b/plonkish_backend/src/backend/hyperplonk/verifier.rs @@ -48,7 +48,7 @@ pub(crate) fn verify_sum_check( y: &[F], transcript: &mut impl FieldTranscriptRead, ) -> Result<(Vec>, Vec>), 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::, BinaryField>::verify( &(), @@ -82,7 +82,7 @@ pub(crate) fn verify_sum_check( )); } - // 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() diff --git a/plonkish_backend/src/circuits/poseidongadget/poseidon/pow5.rs b/plonkish_backend/src/circuits/poseidongadget/poseidon/pow5.rs index eaf8599..0bb6841 100644 --- a/plonkish_backend/src/circuits/poseidongadget/poseidon/pow5.rs +++ b/plonkish_backend/src/circuits/poseidongadget/poseidon/pow5.rs @@ -588,13 +588,13 @@ impl Pow5State { 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; @@ -725,10 +725,10 @@ mod tests { fn instances(&self) -> Vec> { /*let mut expected_final_state = (0..7) - .map(|idx| Fq::from(idx as u64)) - .collect::>() - .try_into() - .unwrap();*/ + .map(|idx| Fq::from(idx as u64)) + .collect::>() + .try_into() + .unwrap();*/ Vec::new() } }