diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 647ecb28e..d7080f71b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -45,3 +45,10 @@ jobs: - uses: actions/checkout@v4 - name: machete uses: bnjbvr/cargo-machete@main + + typos: + name: Spell check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: crate-ci/typos@v1.44.0 diff --git a/_typos.toml b/_typos.toml new file mode 100644 index 000000000..d90213172 --- /dev/null +++ b/_typos.toml @@ -0,0 +1,15 @@ +[default.extend-words] +# Groth16 is a zero-knowledge proof system (not "Growth") +groth = "groth" +Groth = "Groth" +GROTH = "GROTH" + +[files] +extend-exclude = [ + # Notebook outputs contain escaped terminal codes that trigger false positives + "playground/sage/*.ipynb", + # Base64-encoded mock keys contain random substrings + "playground/passport-input-gen/src/mock_keys.rs", + # Typst labels (e.g. ) are not typos + "playground/sage/*.typst", +] diff --git a/noir-examples/babyjubjub/src/montgomery.nr b/noir-examples/babyjubjub/src/montgomery.nr index fc974a97b..a924e9c08 100644 --- a/noir-examples/babyjubjub/src/montgomery.nr +++ b/noir-examples/babyjubjub/src/montgomery.nr @@ -79,13 +79,13 @@ impl MontgomeryPoint { pub fn double(self) -> MontgomeryPoint { // Safety: cast to unconstrained field // lambda = (3*u^2 + 2*A*u + 1) / (2*v) - let lamda = unsafe { Self::double_lambda_unconstrained(self) }; + let lambda = unsafe { Self::double_lambda_unconstrained(self) }; let num = 3 * self.u * self.u + 2 * MONT_A * self.u + 1; let den = 2 * self.v; - assert(lamda * den == num, "Montgomery double slope constraint failed"); + assert(lambda * den == num, "Montgomery double slope constraint failed"); - let u3 = MONT_B * lamda * lamda - MONT_A - 2 * self.u; - let v3 = lamda * (self.u - u3) - self.v; + let u3 = MONT_B * lambda * lambda - MONT_A - 2 * self.u; + let v3 = lambda * (self.u - u3) - self.v; MontgomeryPoint { u: u3, v: v3 } } diff --git a/ntt/src/ntt.rs b/ntt/src/ntt.rs index bf1c65331..2b77a7961 100644 --- a/ntt/src/ntt.rs +++ b/ntt/src/ntt.rs @@ -93,7 +93,7 @@ impl NTTEngine { } } - // Returns the maximum order that it supports without extention + // Returns the maximum order that it supports without extension fn order(&self) -> Pow2 { Pow2(self.0.len() * 2) } diff --git a/playground/cm31_ntt/src/ntt.rs b/playground/cm31_ntt/src/ntt.rs index 683631884..f4600f131 100644 --- a/playground/cm31_ntt/src/ntt.rs +++ b/playground/cm31_ntt/src/ntt.rs @@ -796,7 +796,7 @@ pub fn gen_precomp_full(n: usize, w: CF, block: usize) -> Result> { /// case which accepts an input size of NTT_BLOCK_SIZE_FOR_CACHE, and memory /// allocation via Vecs for the higher levels. This is done to maximise cache /// use and minimise memory allocations. This function expects a reference to a -/// zero buffer as the scratch parameter, of size NTT_BLOCK_SIZE_FOR_CACH, of +/// zero buffer as the scratch parameter, of size NTT_BLOCK_SIZE_FOR_CACHE, of /// size NTT_BLOCK_SIZE_FOR_CACHE. The precomp_small and precomp_full parameters /// are precomputed twiddles for the base NTT and the higher layers, /// respectively. They must be generated using precomputed_twiddles(). diff --git a/playground/cm31_ntt/src/ntt_utils.rs b/playground/cm31_ntt/src/ntt_utils.rs index efad70c29..4cda35b26 100644 --- a/playground/cm31_ntt/src/ntt_utils.rs +++ b/playground/cm31_ntt/src/ntt_utils.rs @@ -55,9 +55,9 @@ pub fn ntt_block_8( wt7: CF, ) -> (CF, CF, CF, CF, CF, CF, CF, CF) { // Refer to Yuval's Radix 8 DIT diagram. - // 1st columm of black dots: a0-a8 - // 2nd columm of black dots: b0-b8 - // 3nd columm of black dots: res[0]-res[8] + // 1st column of black dots: a0-a8 + // 2nd column of black dots: b0-b8 + // 3nd column of black dots: res[0]-res[8] let t0 = f0; let t1 = f1 * wt; diff --git a/playground/cm31_ntt/src/rm31.rs b/playground/cm31_ntt/src/rm31.rs index 743f1aea8..706753e69 100644 --- a/playground/cm31_ntt/src/rm31.rs +++ b/playground/cm31_ntt/src/rm31.rs @@ -92,7 +92,7 @@ impl RF { } pub fn mul_2exp_u64(&self, exp: u64) -> Self { - // Adpated from https://github.com/Plonky3/Plonky3/blob/6049a30c3b1f5351c3eb0f7c994dc97e8f68d10d/mersenne-31/src/lib.rs#L162 + // Adapted from https://github.com/Plonky3/Plonky3/blob/6049a30c3b1f5351c3eb0f7c994dc97e8f68d10d/mersenne-31/src/lib.rs#L162 let reduced = reduce(self.val); let exp = exp % 31; let left = (reduced << exp) & P; @@ -102,7 +102,7 @@ impl RF { } pub fn div_2exp_u64(&self, exp: u64) -> Self { - // Adpated from https://github.com/Plonky3/Plonky3/blob/6049a30c3b1f5351c3eb0f7c994dc97e8f68d10d/mersenne-31/src/lib.rs#L162 + // Adapted from https://github.com/Plonky3/Plonky3/blob/6049a30c3b1f5351c3eb0f7c994dc97e8f68d10d/mersenne-31/src/lib.rs#L162 let reduced = reduce(self.val); let exp = (exp % 31) as u8; let left = reduced >> exp; @@ -383,7 +383,7 @@ mod tests { } } - // Print all faling test cases. This is useful for debugging. I don't use + // Print all failing test cases. This is useful for debugging. I don't use // test_case here as I want to reuse TEST_CASES, and I ran into issues // with test_case name clashes. if failing_test_cases.len() > 0 { diff --git a/playground/sage/fri-and-friends/src/fri.py b/playground/sage/fri-and-friends/src/fri.py index f3d78a190..fa99cbe57 100644 --- a/playground/sage/fri-and-friends/src/fri.py +++ b/playground/sage/fri-and-friends/src/fri.py @@ -143,11 +143,11 @@ def deep_rational_poly(eval_poly, ood_challenges): poly_evals = [(v, eval_poly(v)) for v in ood_challenges] numerator = PolyRing.lagrange_polynomial(poly_evals) x = PolyRing.gen() - denomonator = prod([(x - v) for v in ood_challenges]) - return (numerator, denomonator) + denominator = prod([(x - v) for v in ood_challenges]) + return (numerator, denominator) @staticmethod - def consistancy_cross_check(this_round: Self, prev_round : Self, folding_challenge, queries = 1, ood_response = None): + def consistency_cross_check(this_round: Self, prev_round : Self, folding_challenge, queries = 1, ood_response = None): previous_round_proof = prev_round.gen_proof() this_round_proof = this_round.gen_proof() alphas = [prev_round.folding_root**i for i in range(prev_round.folding_factor)] @@ -232,7 +232,7 @@ def verify_proximity(self, max_degree, query_count = 10): this_fri = this_round.fri_round fold_random = this_round.fold_randomness deep_frac = this_round.deep_poly - is_good = FRIRound.consistancy_cross_check(this_fri, + is_good = FRIRound.consistency_cross_check(this_fri, prev_round, fold_random, query_count, @@ -321,14 +321,14 @@ def verify_proof(self, # Reed Solomon evaluation domains are incompatible! return False - rs_orignal = original.gen_proof() + rs_original = original.gen_proof() rs_quot = quot.gen_proof() votes = 0 for _ in range(self.query_count): - ndx = int(random()*len(rs_orignal)) + ndx = int(random()*len(rs_original)) reconstructed = expected_value + (rs_quot[ndx] * (eval_points[ndx] - evaluation_point)) - if reconstructed == rs_orignal[ndx]: + if reconstructed == rs_original[ndx]: votes += 1 # Overwhelming majority might be too weak! @@ -358,8 +358,8 @@ def run_test_friopp(code_dimension=2048, rate_factor=4, folding_factor=4, ood_co folding_factor=folding_factor, ood_count=ood_count) - assert iopp.verify_proximity(poly_degree), "FRI IOPP varification should work" - assert not iopp.verify_proximity(poly_degree // folding_factor - 1), "FRI IOPP varification should fail if the max degree is 1/folding factor away" + assert iopp.verify_proximity(poly_degree), "FRI IOPP verification should work" + assert not iopp.verify_proximity(poly_degree // folding_factor - 1), "FRI IOPP verification should fail if the max degree is 1/folding factor away" def run_test_fri_round(code_dimension=2048, rate_factor=4, folding_factor=4, ood_count = 5): @@ -371,7 +371,7 @@ def run_test_fri_round(code_dimension=2048, rate_factor=4, folding_factor=4, ood folding_randomness = Fq.random_element() ood_randomness = [Fq.random_element() for _ in range(ood_count)] (second_oracle, ood_response) = first_oracle.fold(folding_randomness, ood_randomness) - assert FRIRound.consistancy_cross_check(second_oracle, first_oracle, folding_challenge=folding_randomness, queries=5, ood_response=ood_response) + assert FRIRound.consistency_cross_check(second_oracle, first_oracle, folding_challenge=folding_randomness, queries=5, ood_response=ood_response) def run_test_pcs(code_dimension=2048, rate_factor=4, folding_factor=4, ood_count = 5): ntt_omega = omega**(cofactor*2**(twodicity - log(code_dimension, 2))) @@ -392,7 +392,7 @@ def run_test_pcs(code_dimension=2048, rate_factor=4, folding_factor=4, ood_count "An invalid opening of evaluation point should not succeed, but it did" assert not verifier.verify_proof(commitment, proof, evaluation_point, expected_value + 1), \ - "An invalid opening of evaluation value shoud not succeed, but it did" + "An invalid opening of evaluation value should not succeed, but it did" run_test_fri_round() run_test_friopp() diff --git a/playground/sage/fri-and-friends/src/whir.py b/playground/sage/fri-and-friends/src/whir.py index 19e20273e..961153ebe 100644 --- a/playground/sage/fri-and-friends/src/whir.py +++ b/playground/sage/fri-and-friends/src/whir.py @@ -132,7 +132,7 @@ def fold_virtually(oracle_ndxes : list[int], # list of indices in proof oracle 1. First compute the fold_factor ℓ := 2^{len(fold_challenges)} 2. Compute ℓ-th roots of unity `fold_omega` from `ntt_omega`. - 2. Given `ndx`, compute other indicies that are ℓ-th root + 2. Given `ndx`, compute other indices that are ℓ-th root conjugates corresponding to `ndx`. 3. Given a polynomial f(x), it can be written as f(x) = f_0(x^ℓ) + x•f_1(x^ℓ) + ••• + x^{ℓ}•f_{ℓ-1}(x^ℓ) @@ -193,12 +193,12 @@ def __init__(self, last_whir_round: Self, whir_round : Self, ood_data: dict[FiniteField, FiniteField] , - shift_qeries : list[FiniteField], + shift_queries : list[FiniteField], ): self.last_round = last_whir_round self.this_round = whir_round self.ood_data = ood_data - self.shift_queries = shift_qeries + self.shift_queries = shift_queries def __init__(self, @@ -515,7 +515,7 @@ def update_weight(self, trace : bool = True ): ood_challenge = list(ood_query.keys())[0] - ood_reponse = ood_query[ood_challenge] + ood_response = ood_query[ood_challenge] weight_eq_vars = self.polyvars() @@ -525,7 +525,7 @@ def update_weight(self, weight = weight_updt(ood_challenge) if trace: - print(f"\n V> Weight update for OOD challenge {ood_challenge} => {ood_reponse} : {self.weight_var}*({weight})") + print(f"\n V> Weight update for OOD challenge {ood_challenge} => {ood_response} : {self.weight_var}*({weight})") update_sum = gamma*weight @@ -540,7 +540,7 @@ def update_weight(self, if trace: print(f" V> Updated new weight: {self.weight_polynomial}") - h_terms = [ood_reponse] + [r for (_,r) in shift_query] + h_terms = [ood_response] + [r for (_,r) in shift_query] h_update = sum([ sresp * gamma**(i+1) for (i,sresp) in enumerate(h_terms)]) if trace: diff --git a/playground/sage/fri-and-friends/whir.ipynb b/playground/sage/fri-and-friends/whir.ipynb index 29dda7260..ff3d28f1e 100644 --- a/playground/sage/fri-and-friends/whir.ipynb +++ b/playground/sage/fri-and-friends/whir.ipynb @@ -350,8 +350,8 @@ ], "source": [ "verifier = WhirVerifier(weight_poly, ntt_omega, pcs_evaluation_claim)\n", - "succes = verifier.validate_pcs_claim(prover)\n", - "if succes == True:\n", + "success = verifier.validate_pcs_claim(prover)\n", + "if success == True:\n", " print(f\"PCS verification succeeded\")\n", "else:\n", " print(f\"PCS verification failed\")" @@ -395,8 +395,8 @@ "prover = WhirRound(input_poly, weight_poly, ntt_omega, pcs_evaluation_claim)\n", "\n", "verifier = WhirVerifier(weight_poly, ntt_omega, pcs_evaluation_claim + 1)\n", - "succes = verifier.validate_pcs_claim(prover)\n", - "if succes == True:\n", + "success = verifier.validate_pcs_claim(prover)\n", + "if success == True:\n", " print(f\"PCS verification succeeded\")\n", "else:\n", " print(f\"PCS verification failed\")" diff --git a/provekit/common/src/utils/sumcheck.rs b/provekit/common/src/utils/sumcheck.rs index 207d76be4..d703d8cd4 100644 --- a/provekit/common/src/utils/sumcheck.rs +++ b/provekit/common/src/utils/sumcheck.rs @@ -157,7 +157,7 @@ pub fn eval_cubic_poly(poly: [FieldElement; 4], point: FieldElement) -> FieldEle poly[0] + point * (poly[1] + point * (poly[2] + point * poly[3])) } -/// Given a path to JSON file with sparce matrices and a witness, calculates +/// Given a path to JSON file with sparse matrices and a witness, calculates /// matrix-vector multiplication and returns them #[instrument(skip_all)] pub fn calculate_witness_bounds( diff --git a/provekit/r1cs-compiler/src/memory/ram.rs b/provekit/r1cs-compiler/src/memory/ram.rs index b7b666fef..6dc88dab7 100644 --- a/provekit/r1cs-compiler/src/memory/ram.rs +++ b/provekit/r1cs-compiler/src/memory/ram.rs @@ -92,7 +92,7 @@ pub fn add_ram_checking( // required range checks later. let mut all_mem_op_index_and_rt = vec![]; - // For each of the writes in the inititialization, add a factor to the write + // For each of the writes in the initialization, add a factor to the write // hash block .initial_value_witnesses diff --git a/recursive-verifier/app/circuit/mtUtilities.go b/recursive-verifier/app/circuit/mtUtilities.go index 6e1b0d5ca..5f44e6507 100644 --- a/recursive-verifier/app/circuit/mtUtilities.go +++ b/recursive-verifier/app/circuit/mtUtilities.go @@ -34,8 +34,8 @@ func initialSumcheck( } combinedLinearStatementEvaluations[evaluationIndex] = sum } - OODAnswersAndStatmentEvaluations := append(initialOODAnswers, combinedLinearStatementEvaluations...) - lastEval := utilities.DotProduct(api, initialCombinationRandomness, OODAnswersAndStatmentEvaluations) + OODAnswersAndStatementEvaluations := append(initialOODAnswers, combinedLinearStatementEvaluations...) + lastEval := utilities.DotProduct(api, initialCombinationRandomness, OODAnswersAndStatementEvaluations) initialSumcheckFoldingRandomness, lastEval, err := runWhirSumcheckRounds(api, lastEval, arthur, whirParams.FoldingFactorArray[0], 3) if err != nil { diff --git a/recursive-verifier/app/circuit/types.go b/recursive-verifier/app/circuit/types.go index f6db49d00..bc748b432 100644 --- a/recursive-verifier/app/circuit/types.go +++ b/recursive-verifier/app/circuit/types.go @@ -53,7 +53,7 @@ type WHIRParams struct { FinalFoldingPowBits int StartingDomainBackingDomainGenerator frontend.Variable DomainSize int - CommittmentOODSamples int + CommitmentOODSamples int FinalSumcheckRounds int MVParamsNumberOfVariables int BatchSize int diff --git a/recursive-verifier/app/circuit/whir.go b/recursive-verifier/app/circuit/whir.go index 05cd29cdd..e6d4a1d70 100644 --- a/recursive-verifier/app/circuit/whir.go +++ b/recursive-verifier/app/circuit/whir.go @@ -40,7 +40,7 @@ func NewWhirParams(cfg WHIRConfig) WHIRParams { FinalFoldingPowBits: cfg.FinalFoldingPowBits, StartingDomainBackingDomainGenerator: *startingDomainGen, DomainSize: domainSize, - CommittmentOODSamples: 1, + CommitmentOODSamples: 1, FinalSumcheckRounds: finalSumcheckRounds, MVParamsNumberOfVariables: mvParamsNumberOfVariables, BatchSize: cfg.BatchSize, @@ -598,20 +598,20 @@ func runWhir( return } - initialOODQueries, initialOODAnswers, tempErr := fillInOODPointsAndAnswers(whirParams.CommittmentOODSamples, arthur) + initialOODQueries, initialOODAnswers, tempErr := fillInOODPointsAndAnswers(whirParams.CommitmentOODSamples, arthur) if tempErr != nil { err = tempErr return } - initialCombinationRandomness, tempErr := GenerateCombinationRandomness(api, arthur, whirParams.CommittmentOODSamples+len(linearStatementEvaluations)) + initialCombinationRandomness, tempErr := GenerateCombinationRandomness(api, arthur, whirParams.CommitmentOODSamples+len(linearStatementEvaluations)) if tempErr != nil { err = tempErr return } - OODAnswersAndStatmentEvaluations := append(initialOODAnswers, linearStatementEvaluations...) - lastEval := utilities.DotProduct(api, initialCombinationRandomness, OODAnswersAndStatmentEvaluations) + OODAnswersAndStatementEvaluations := append(initialOODAnswers, linearStatementEvaluations...) + lastEval := utilities.DotProduct(api, initialCombinationRandomness, OODAnswersAndStatementEvaluations) initialSumcheckFoldingRandomness, lastEval, tempErr := runWhirSumcheckRounds(api, lastEval, arthur, whirParams.FoldingFactorArray[0], 3) if tempErr != nil { diff --git a/recursive-verifier/app/circuit/whir_utilities.go b/recursive-verifier/app/circuit/whir_utilities.go index ac75a9c34..2fd30f91c 100644 --- a/recursive-verifier/app/circuit/whir_utilities.go +++ b/recursive-verifier/app/circuit/whir_utilities.go @@ -140,7 +140,7 @@ func computeWPoly( value = api.Add(value, api.Mul(initialData.InitialCombinationRandomness[j], utilities.EqPolyOutside(api, utilities.ExpandFromUnivariate(api, initialData.InitialOODQueries[j], numberVars), totalFoldingRandomness))) } - // Values are directly used as all linearStatements are deffered and hints were given. Checking of hints will be done later on. + // Values are directly used as all linearStatements are deferred and hints were given. Checking of hints will be done later on. for j, linearStatementValueAtPoint := range linearStatementValuesAtPoints { value = api.Add(value, api.Mul(initialData.InitialCombinationRandomness[len(initialData.InitialOODQueries)+j], linearStatementValueAtPoint)) } diff --git a/skyscraper/bn254-multiplier/examples/count.rs b/skyscraper/bn254-multiplier/examples/count.rs index 6f5c7b243..8fc5fb4ad 100644 --- a/skyscraper/bn254-multiplier/examples/count.rs +++ b/skyscraper/bn254-multiplier/examples/count.rs @@ -53,7 +53,7 @@ fn diagonal() -> [usize; 12] { println!(); } - // Since there is no data of the diagionals yet it is safe to double them. This + // Since there is no data of the diagonals yet it is safe to double them. This // means that t[8][1] = t[9] needs to be included. // t[0][1] is not touched by the diagonalisation so no need to include t[0] diff --git a/skyscraper/core/src/reduce.rs b/skyscraper/core/src/reduce.rs index d65f1399e..b65be380d 100644 --- a/skyscraper/core/src/reduce.rs +++ b/skyscraper/core/src/reduce.rs @@ -43,7 +43,7 @@ pub fn reduce_partial(x: [u64; 4]) -> [u64; 4] { /// Combined partial reduction and add round constant /// Input can be any value. /// Output is in range [0, 2M + ϵ) (TODO: Analyse more carefully) -/// TODO: Maybe with a round dependend lookup factor it can be [0, M + ϵ) +/// TODO: Maybe with a round dependent lookup factor it can be [0, M + ϵ) #[inline(always)] pub fn reduce_partial_add_rc(x: [u64; 4], rc: usize) -> [u64; 4] { // The compiler should turn this division by constant into an umulh. diff --git a/skyscraper/fp-rounding/src/lib.rs b/skyscraper/fp-rounding/src/lib.rs index a9089aec3..46f651a0c 100644 --- a/skyscraper/fp-rounding/src/lib.rs +++ b/skyscraper/fp-rounding/src/lib.rs @@ -67,7 +67,7 @@ pub unsafe fn with_rounding_mode( let guard = RoundingGuard::new(); // Tie the mode to the input such that mode will be seated before the first use // of input by f. - // Tieing the input to the Mode does not seem to be strictly necessary, but it's + // Tying the input to the Mode does not seem to be strictly necessary, but it's // here for added safety. let (guard, input) = fence((guard, input)); let result = f(&guard, input);