Skip to content

Commit

Permalink
feat: typos check in ci
Browse files Browse the repository at this point in the history
  • Loading branch information
adria0 committed Aug 8, 2024
1 parent bc857a7 commit b864585
Show file tree
Hide file tree
Showing 15 changed files with 93 additions and 69 deletions.
44 changes: 30 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,36 @@ on:
- main

jobs:

fmt:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

typos-check:
needs: [skip_check]
if: |
github.event.pull_request.draft == false &&
(github.event.action == 'ready_for_review' || needs.skip_check.outputs.should_skip != 'true')
name: TyposCheck
timeout-minutes: 5
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/[email protected]
with:
config: ./typos.toml
isolated: true
test:
name: Test on ${{ matrix.os }} with ${{ matrix.feature_set }} features
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -101,18 +131,4 @@ jobs:
command: doc
args: --all --document-private-items

fmt:
name: Rustfmt
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
override: false
- run: rustup component add rustfmt
- uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ This repository contains the [halo2](https://github.com/zcash/halo2) fork from
PSE and includes contributions from the community.

We use the `main` branch for development, which means it may contain
unstable/unfinished features. For end-users we recomend using the tag releases
unstable/unfinished features. For end-users we recommend using the tag releases
which can be seen as curated checkpoints with some level of guarantee of
stability.

Expand Down
4 changes: 2 additions & 2 deletions book/src/user/experimental-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ When using `create_proof` and `verify_proof`, we need to specify the commitment
create_proof<IPACommitmentScheme<_>, ProverIPA<_>, _, _, _, _>
verify_proof<IPACommitmentScheme<_>, ProverIPA<_>, _, _, _>

// Using KZG with GWC19 mutli-open strategy
// Using KZG with GWC19 multi-open strategy
create_proof<KZGCommitmentScheme<_>, ProverGWC<_>, _, _, _, _>
verify_proof<KZGCommitmentScheme<_>, ProverGWC<_>, _, _, _>

// Using KZG with BDFG20 mutli-open strategy
// Using KZG with BDFG20 multi-open strategy
create_proof<KZGCommitmentScheme<_>, ProverSHPLONK<_>, _, _, _, _>
verify_proof<KZGCommitmentScheme<_>, ProverSHPLONK<_>, _, _, _>
```
Expand Down
2 changes: 1 addition & 1 deletion halo2_backend/src/plonk.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where
return Err(io::Error::new(
io::ErrorKind::InvalidData,
format!(
"circuit size value (k): {} exceeds maxium: {}",
"circuit size value (k): {} exceeds maximum: {}",
k,
C::Scalar::S
),
Expand Down
6 changes: 3 additions & 3 deletions halo2_backend/src/plonk/evaluation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,11 +174,11 @@ impl Calculation {
/// Evaluator
#[derive(Clone, Default, Debug)]
pub(crate) struct Evaluator<C: CurveAffine> {
/// Custom gates evalution
/// Custom gates evaluation
custom_gates: GraphEvaluator<C>,
/// Lookups evalution
/// Lookups evaluation
lookups: Vec<GraphEvaluator<C>>,
/// Shuffle evalution
/// Shuffle evaluation
shuffles: Vec<GraphEvaluator<C>>,
}

Expand Down
73 changes: 37 additions & 36 deletions halo2_backend/src/plonk/prover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,10 +489,10 @@ impl<

/// Finalizes the proof creation.
/// The following steps are performed:
/// - 1. Generate commited lookup polys
/// - 2. Generate commited permutation polys
/// - 3. Generate commited lookup polys
/// - 4. Generate commited shuffle polys
/// - 1. Generate committed lookup polys
/// - 2. Generate committed permutation polys
/// - 3. Generate committed lookup polys
/// - 4. Generate committed shuffle polys
/// - 5. Commit to the vanishing argument's random polynomial
/// - 6. Generate the advice polys
/// - 7. Evaluate the h(X) polynomial
Expand Down Expand Up @@ -523,7 +523,7 @@ impl<
.map(|index| challenges.remove(&index).unwrap())
.collect::<Vec<_>>();

// 1. Generate commited ( added to transcript ) lookup polys ---------------------------------------
// 1. Generate committed ( added to transcript ) lookup polys ---------------------------------------

// Sample theta challenge for keeping lookup columns linearly independent
// [TRANSCRIPT-5]
Expand Down Expand Up @@ -574,9 +574,9 @@ impl<
// [TRANSCRIPT-8]
let gamma: ChallengeGamma<_> = self.transcript.squeeze_challenge_scalar();

// 2. Generate commited permutation polys -----------------------------------------
// 2. Generate committed permutation polys -----------------------------------------
// [TRANSCRIPT-9]
let permutations_commited: Vec<permutation::prover::Committed<Scheme::Curve>> = instances
let permutations_committed: Vec<permutation::prover::Committed<Scheme::Curve>> = instances
.iter()
.zip(advices.iter())
.map(|(instance, advice)| {
Expand All @@ -597,34 +597,35 @@ impl<
})
.collect::<Result<Vec<_>, _>>()?;

// 3. Generate commited lookup polys ----------------------------------------------------------
// 3. Generate committed lookup polys ----------------------------------------------------------

// [TRANSCRIPT-10]
let lookups_commited: Vec<Vec<lookup::prover::Committed<Scheme::Curve>>> = permuted_lookups
.into_iter()
.map(|lookups| -> Result<Vec<_>, _> {
// Construct and commit to products for each lookup
lookups
.into_iter()
.map(|lookup| {
lookup.commit_product(
&self.engine,
pk,
params,
beta,
gamma,
&mut rng,
self.transcript,
)
})
.collect::<Result<Vec<_>, _>>()
})
.collect::<Result<Vec<_>, _>>()?;
let lookups_committed: Vec<Vec<lookup::prover::Committed<Scheme::Curve>>> =
permuted_lookups
.into_iter()
.map(|lookups| -> Result<Vec<_>, _> {
// Construct and commit to products for each lookup
lookups
.into_iter()
.map(|lookup| {
lookup.commit_product(
&self.engine,
pk,
params,
beta,
gamma,
&mut rng,
self.transcript,
)
})
.collect::<Result<Vec<_>, _>>()
})
.collect::<Result<Vec<_>, _>>()?;

// 4. Generate commited shuffle polys -------------------------------------------------------
// 4. Generate committed shuffle polys -------------------------------------------------------

// [TRANSCRIPT-11]
let shuffles_commited: Vec<Vec<shuffle::prover::Committed<Scheme::Curve>>> = instances
let shuffles_committed: Vec<Vec<shuffle::prover::Committed<Scheme::Curve>>> = instances
.iter()
.zip(advices.iter())
.map(|(instance, advice)| -> Result<Vec<_>, _> {
Expand Down Expand Up @@ -703,9 +704,9 @@ impl<
*beta,
*gamma,
*theta,
&lookups_commited,
&shuffles_commited,
&permutations_commited,
&lookups_committed,
&shuffles_committed,
&permutations_committed,
);

// 8. Construct the vanishing argument's h(X) commitments --------------------------------------
Expand Down Expand Up @@ -796,15 +797,15 @@ impl<
// Evaluate the permutations, if any, at omega^i x.
// [TRANSCRIPT-21]
let permutations_evaluated: Vec<permutation::prover::Evaluated<Scheme::Curve>> =
permutations_commited
permutations_committed
.into_iter()
.map(|permutation| -> Result<_, _> { permutation.evaluate(pk, x, self.transcript) })
.collect::<Result<Vec<_>, _>>()?;

// Evaluate the lookups, if any, at omega^i x.
// [TRANSCRIPT-22]
let lookups_evaluated: Vec<Vec<lookup::prover::Evaluated<Scheme::Curve>>> =
lookups_commited
lookups_committed
.into_iter()
.map(|lookups| -> Result<Vec<_>, _> {
lookups
Expand All @@ -817,7 +818,7 @@ impl<
// Evaluate the shuffles, if any, at omega^i x.
// [TRANSCRIPT-23]
let shuffles_evaluated: Vec<Vec<shuffle::prover::Evaluated<Scheme::Curve>>> =
shuffles_commited
shuffles_committed
.into_iter()
.map(|shuffles| -> Result<Vec<_>, _> {
shuffles
Expand Down
6 changes: 3 additions & 3 deletions halo2_frontend/src/dev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1498,7 +1498,7 @@ mod tests {
#[cfg(feature = "lookup-any-sanity-checks")]
#[test]
#[should_panic(
expected = "pair of tagging expressions(query of the tag columns or mutiple query combinations) should be included"
expected = "pair of tagging expressions(query of the tag columns or multiple query combinations) should be included"
)]
fn bad_lookup_any_not_add_tagging_pairs() {
const K: u32 = 4;
Expand Down Expand Up @@ -1991,7 +1991,7 @@ mod tests {
}

#[test]
fn contraint_unsatisfied() {
fn constraint_unsatisfied() {
const K: u32 = 4;

#[derive(Clone)]
Expand Down Expand Up @@ -2234,7 +2234,7 @@ mod tests {
instance[0] = InstanceValue::Assigned(Fp::from(11));
assert_eq!(prover.verify(), Err(vec![err2.clone()]));

// then we modify the witness -> the contraint `squared` will fail
// then we modify the witness -> the constraint `squared` will fail
let advice0 = prover.advice_mut(0);
advice0[2] = CellValue::Assigned(Fp::from(10));
assert_eq!(prover.verify(), Err(vec![err1, err2]));
Expand Down
4 changes: 2 additions & 2 deletions halo2_frontend/src/dev/cost_model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ use super::MockProver;
pub enum CommitmentScheme {
/// Inner Product Argument commitment scheme
IPA,
/// KZG with GWC19 mutli-open strategy
/// KZG with GWC19 multi-open strategy
KZGGWC,
/// KZG with BDFG20 mutli-open strategy
/// KZG with BDFG20 multi-open strategy
KZGSHPLONK,
}

Expand Down
4 changes: 2 additions & 2 deletions halo2_frontend/src/plonk/circuit/constraint_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ impl<F: Field> ConstraintSystem<F> {
panic!("all table expressions need selector/fixed query for tagging");
}
if !is_tagging_exprs_pair_exists {
panic!("pair of tagging expressions(query of the tag columns or mutiple query combinations) should be included");
panic!("pair of tagging expressions(query of the tag columns or multiple query combinations) should be included");
}
}

Expand Down Expand Up @@ -953,7 +953,7 @@ impl<F: Field> ConstraintSystem<F> {
tmp
}

/// Helper funciotn to assert phase exists, to make sure phase-aware resources
/// Helper function to assert phase exists, to make sure phase-aware resources
/// are allocated in order, and to avoid any phase to be skipped accidentally
/// to cause unexpected issue in the future.
fn assert_phase_exists(&self, phase: sealed::Phase, resource: &str) {
Expand Down
2 changes: 1 addition & 1 deletion halo2_middleware/src/zal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ pub mod traits {
// Descriptors are opaque pointers that hold the input in a format suitable for the accelerator engine.
// They may be:
// - Input moved on accelerator device (only once for repeated calls)
// - Endianess conversion
// - Endianness conversion
// - Converting from Montgomery to Canonical form
// - Input changed from Projective to Jacobian coordinates or even to a Twisted Edwards curve.
// - other form of expensive preprocessing
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ All APIs that represented witnessed values as `Option<V>` now represent them as
directly, and returns `VerificationStrategy::Output` instead of `Guard`.
- `ConstraintSystem::enable_equality` and `ConstraintSystem::query_any` now
take `Into<Column<Any>>` instead of `Column<Any>` as a parameter to avoid
excesive `.into()` usage.
excessive `.into()` usage.
- `Error` has been overhauled:
- `Error` now implements `std::fmt::Display` and `std::error::Error`.
- `Error` no longer implements `PartialEq`. Tests can check for specific
Expand Down
2 changes: 1 addition & 1 deletion halo2_proofs/tests/frontend_backend_split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ struct MyCircuitConfig {
s_lookup: Column<Fixed>,
s_ltable: Column<Fixed>,

// A shuffle: s_shufle * [1, a[0]] shuffle_of s_stable * [1, b[0]]
// A shuffle: s_shuffle * [1, a[0]] shuffle_of s_stable * [1, b[0]]
s_shuffle: Column<Fixed>,
s_stable: Column<Fixed>,

Expand Down
2 changes: 1 addition & 1 deletion p3_frontend/src/fwrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ impl<F: PrimeField + Hash + Ord> p3PrimeField for FWrap<F> {
}

// HACK: In general an `FWrap` will need more than 64 bits. This trait is only implemented in
// order to use `FWrap` with witness generation from plonky3 that requries this trait but doesn't
// order to use `FWrap` with witness generation from plonky3 that requires this trait but doesn't
// use the order. Do not use an `ff::PrimeField` on a circuit that requires a 64 bit prime field
// (i.e. relies on the `ORDER_U64` value), only use it on circuits that always assign less than 64
// bit values on the field elements.
Expand Down
2 changes: 1 addition & 1 deletion p3_frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ where
}

// Check if the constraint is an equality against a public input and extract the copy constraint as
// `(advice_column_index, Location)` and `public_index`. If there's no copy constriant, return
// `(advice_column_index, Location)` and `public_index`. If there's no copy constraint, return
// None.
fn extract_copy_public<F: PrimeField + Hash>(
e: &SymbolicExpression<FWrap<F>>,
Expand Down
7 changes: 7 additions & 0 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[default]
extend-ignore-re=[
"master-thm",
"[aA]dvices",
"projectives"
]
check-filename = true

0 comments on commit b864585

Please sign in to comment.