Skip to content
This repository was archived by the owner on Jul 5, 2024. It is now read-only.

Commit fe3a814

Browse files
Add typos tool to CI to automate typo detection (#1817)
### Description - `advices` -> `advice` but It has appeared many times,Fear of side effects from excessive changes, this PR do not process this typo for now - `extend-exclude = ["integration-tests/contracts"]` is third party lib ### Issue Link close:#1781 --------- Co-authored-by: Chih Cheng Liang <[email protected]>
1 parent 9a13854 commit fe3a814

File tree

16 files changed

+58
-27
lines changed

16 files changed

+58
-27
lines changed

.github/workflows/config/typos.toml

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[default.extend-words]
2+
groth = "groth"
3+
pn = "pn"
4+
struc = "struc"
5+
ba = "ba"
6+
advices = "advices"
7+
unexpect = "unexpect"
8+
Convertion = "Convertion"
9+
10+
[files]
11+
extend-exclude = ["integration-tests/contracts"]

.github/workflows/typos.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Typo Check
2+
3+
on:
4+
merge_group:
5+
pull_request:
6+
types: [synchronize, opened, reopened, ready_for_review]
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
typos:
13+
name: Spell Check with Typos
14+
runs-on: ubuntu-22.04
15+
steps:
16+
- uses: actions/checkout@v4
17+
- name: Use typos with config file
18+
uses: crate-ci/[email protected]
19+
with:
20+
config: .github/workflows/config/typos.toml

bus-mapping/src/circuit_input_builder.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ pub trait CircuitsParams: Debug + Copy {
148148
fn total_chunks(&self) -> usize;
149149
/// Set total number of chunks
150150
fn set_total_chunk(&mut self, total_chunks: usize);
151-
/// Return the maximun Rw
151+
/// Return the maximum Rw
152152
fn max_rws(&self) -> Option<usize>;
153153
}
154154

@@ -211,7 +211,7 @@ impl Default for FixedCParams {
211211
/// [`eth_types::GethExecTrace`] to build the circuit input associated with
212212
/// each transaction, and the bus-mapping operations associated with each
213213
/// [`eth_types::GethExecStep`] in the [`eth_types::GethExecTrace`]. 3. If `Rw`s
214-
/// generated during Transactions exceed the `max_rws` threshold, seperate witness
214+
/// generated during Transactions exceed the `max_rws` threshold, separate witness
215215
/// into multiple chunks.
216216
///
217217
/// The generated bus-mapping operations are:
@@ -366,7 +366,7 @@ impl<'a, C: CircuitsParams> CircuitInputBuilder<C> {
366366
return Ok(false);
367367
};
368368

369-
// Optain the first op of the next GethExecStep, for fixed case also lookahead
369+
// Obtain the first op of the next GethExecStep, for fixed case also lookahead
370370
let (mut cib, mut tx, mut tx_ctx) = (self.clone(), tx, tx_ctx);
371371
let mut cib_ref = cib.state_ref(&mut tx, &mut tx_ctx);
372372
let mut next_ops = if let Some((i, step)) = next_geth_step {
@@ -397,8 +397,8 @@ impl<'a, C: CircuitsParams> CircuitInputBuilder<C> {
397397
/// `self.block.container`, and each step stores the
398398
/// [`OperationRef`](crate::exec_trace::OperationRef) to each of the
399399
/// generated operations.
400-
/// When dynamic builder handles Tx with is_chuncked = false, we don't chunk
401-
/// When fixed builder handles Tx with is_chuncked = true, we chunk
400+
/// When dynamic builder handles Tx with is_chunked = false, we don't chunk
401+
/// When fixed builder handles Tx with is_chunked = true, we chunk
402402
fn handle_tx(
403403
&mut self,
404404
eth_tx: &eth_types::Transaction,
@@ -475,7 +475,7 @@ impl<'a, C: CircuitsParams> CircuitInputBuilder<C> {
475475
self.check_and_chunk(geth_trace, tx.clone(), tx_ctx.clone(), None, None)?;
476476
if is_chunk {
477477
// TODO we dont support chunk after invalid_tx
478-
// becasuse begin_chunk will constraints what next step execution state.
478+
// because begin_chunk will constraints what next step execution state.
479479
// And for next step either begin_tx or invalid_tx will both failed because
480480
// begin_tx/invalid_tx define new execution state.
481481
unimplemented!("dont support invalid_tx with multiple chunks")
@@ -814,7 +814,7 @@ impl CircuitInputBuilder<FixedCParams> {
814814
);
815815
assert!(
816816
self.chunks.len() == self.chunk_ctx.idx + 1,
817-
"number of chunks {} mis-match with chunk_ctx id {}",
817+
"number of chunks {} miss-match with chunk_ctx id {}",
818818
self.chunks.len(),
819819
self.chunk_ctx.idx + 1,
820820
);
@@ -975,7 +975,7 @@ impl CircuitInputBuilder<DynamicCParams> {
975975
}
976976

977977
/// Handle a block by handling each transaction to generate all the
978-
/// associated operations. Dry run the block to determind the target
978+
/// associated operations. Dry run the block to determined the target
979979
/// [`FixedCParams`] from to total number of chunks.
980980
pub fn handle_block(
981981
self,
@@ -1054,7 +1054,7 @@ pub fn keccak_inputs_tx_circuit(
10541054
chain_id: u64,
10551055
) -> Result<Vec<Vec<u8>>, Error> {
10561056
let mut inputs = Vec::new();
1057-
let sign_datas: Vec<SignData> = txs
1057+
let sign_data: Vec<SignData> = txs
10581058
.iter()
10591059
.enumerate()
10601060
.filter(|(i, tx)| {
@@ -1068,7 +1068,7 @@ pub fn keccak_inputs_tx_circuit(
10681068
.map(|(_, tx)| tx.sign_data(chain_id))
10691069
.try_collect()?;
10701070
// Keccak inputs from SignVerify Chip
1071-
let sign_verify_inputs = keccak_inputs_sign_verify(&sign_datas);
1071+
let sign_verify_inputs = keccak_inputs_sign_verify(&sign_data);
10721072
inputs.extend_from_slice(&sign_verify_inputs);
10731073
// NOTE: We don't verify the Tx Hash in the circuit yet, so we don't have more
10741074
// hash inputs.

bus-mapping/src/circuit_input_builder/tracer_tests.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ fn tracer_invalid_tx_insufficient_balance() {
427427

428428
#[test]
429429
fn tracer_err_address_collision() {
430-
// We do CREATE2 twice with the same parameters, with a code_creater
430+
// We do CREATE2 twice with the same parameters, with a code_creator
431431
// that outputs the same, which will lead to the same new
432432
// contract address.
433433
let code_creator = bytecode! {
@@ -540,7 +540,7 @@ fn tracer_err_address_collision() {
540540

541541
#[test]
542542
fn tracer_create_collision_free() {
543-
// We do CREATE twice with the same parameters, with a code_creater
543+
// We do CREATE twice with the same parameters, with a code_creator
544544
// that outputs not the same, which will lead to the different new
545545
// contract address.
546546
let code_creator = bytecode! {

geth-utils/gethutil/mpt/trie/committer.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ type leaf struct {
3939

4040
// committer is a type used for the trie Commit operation. A committer has some
4141
// internal preallocated temp space, and also a callback that is invoked when
42-
// leaves are committed. The leafs are passed through the `leafCh`, to allow
42+
// leaves are committed. The leaves are passed through the `leafCh`, to allow
4343
// some level of parallelism.
4444
// By 'some level' of parallelism, it's still the case that all leaves will be
4545
// processed sequentially - onleaf will never be called in parallel or out of order.
@@ -243,7 +243,7 @@ func (c *committer) makeHashNode(data []byte) HashNode {
243243

244244
// estimateSize estimates the size of an rlp-encoded node, without actually
245245
// rlp-encoding it (zero allocs). This method has been experimentally tried, and with a trie
246-
// with 1000 leafs, the only errors above 1% are on small shortnodes, where this
246+
// with 1000 leaves, the only errors above 1% are on small shortnodes, where this
247247
// method overestimates by 2 or 3 bytes (e.g. 37 instead of 35)
248248
func estimateSize(n Node) int {
249249
switch n := n.(type) {

geth-utils/gethutil/mpt/trie/trie.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ type LeafCallback func(paths [][]byte, hexpath []byte, leaf []byte, parent commo
6060
type Trie struct {
6161
db *Database
6262
root Node
63-
// Keep track of the number leafs which have been inserted since the last
63+
// Keep track of the number leaves which have been inserted since the last
6464
// hashing operation. This number will not directly map to the number of
6565
// actually unhashed nodes
6666
unhashed int

geth-utils/gethutil/mpt/witness/gen_witness_from_infura_blockchain_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ func TestAddBranchTwoLevels(t *testing.T) {
465465
// Test for case when branch is added in the second level. So, instead of having only
466466
// branch1 with some nodes and then one of this nodes is replaced with a branch (that's
467467
// the case of TestAddBranch), we have here branch1 and then inside it another
468-
// branch: branch2. Inside brach2 we have a node which gets replaced by a branch.
468+
// branch: branch2. Inside branch2 we have a node which gets replaced by a branch.
469469
// This is to test cases when the key contains odd number of nibbles as well as
470470
// even number of nibbles.
471471

testool/src/statetest/executor.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub enum StateTestError {
2727
NonceMismatch { expected: u64, found: u64 },
2828
#[error("CodeMismatch(expected: {expected:?}, found:{found:?})")]
2929
CodeMismatch { expected: Bytes, found: Bytes },
30-
#[error("StorgeMismatch(slot:{slot:?} expected:{expected:?}, found: {found:?})")]
30+
#[error("StorageMismatch(slot:{slot:?} expected:{expected:?}, found: {found:?})")]
3131
StorageMismatch {
3232
slot: U256,
3333
expected: U256,

testool/src/statetest/json.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ impl<'a> JsonStateTestBuilder<'a> {
107107
Self { compiler }
108108
}
109109

110-
/// generates `StateTest` vectors from a ethereum josn test specification
110+
/// generates `StateTest` vectors from a ethereum json test specification
111111
pub fn load_json(&mut self, path: &str, source: &str) -> Result<Vec<StateTest>> {
112112
let mut state_tests = Vec::new();
113113
let tests: HashMap<String, JsonStateTest> = serde_json::from_str(source)?;

testool/src/statetest/results.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ impl ResultLevel {
4141
use ResultLevel::*;
4242
match self {
4343
Panic => "💀PANIC",
44-
Fail => "🔴FAILD",
45-
Ignored => "🟠IGNOR",
44+
Fail => "🔴FAIL",
45+
Ignored => "🟠IGNORE",
4646
Success => "🟢SUCCS",
4747
}
4848
.to_string()

zkevm-circuits/src/evm_circuit/util/math_gadget/abs_word.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ mod tests {
188188
}
189189

190190
#[test]
191-
fn test_abs_unexpected_is_neg_for_negitive() {
191+
fn test_abs_unexpected_is_neg_for_negative() {
192192
try_test!(AbsWordGadgetContainer<Fr, false>, [Word::MAX, Word::from(1)], false);
193193
}
194194
}

zkevm-circuits/src/evm_circuit/util/memory_gadget.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ mod test {
797797
}
798798

799799
#[test]
800-
fn test_buffer_reader_gadget_completness() {
800+
fn test_buffer_reader_gadget_completeness() {
801801
// buffer len = data len
802802
try_test!(
803803
BufferReaderGadgetTestContainer<Fr, 2, 10>,

zkevm-circuits/src/mpt_circuit/account_leaf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ impl<F: Field> AccountLeafConfig<F> {
409409
} elsex {
410410
ifx! {and::expr(&[not!(config.parent_data[true.idx()].is_placeholder), not!(config.parent_data[false.idx()].is_placeholder)]) => {
411411
// Check that there is only one modification, except when the account is being deleted or
412-
// the parent branch is a placeholder (meaning the account leafs in S are C are different).
412+
// the parent branch is a placeholder (meaning the account leaves in S are C are different).
413413
// Nonce needs to remain the same when not modifying the nonce
414414
ifx!{not!(config.is_nonce_mod) => {
415415
require!(nonce[false.idx()] => nonce[true.idx()]);

zkevm-circuits/src/root_circuit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ impl<T: Clone + Copy> SuperCircuitInstance<T> {
104104
}
105105
}
106106

107-
/// UserChallange
107+
/// UserChallenge
108108
#[derive(Clone)]
109109
pub struct UserChallenge {
110110
/// column_indexes

zkevm-circuits/src/tx_circuit.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ impl<F: Field> SubCircuit<F> for TxCircuit<F> {
337337
layouter: &mut impl Layouter<F>,
338338
) -> Result<(), Error> {
339339
assert!(self.txs.len() <= self.max_txs);
340-
let sign_datas: Vec<SignData> = self
340+
let sign_data: Vec<SignData> = self
341341
.txs
342342
.iter()
343343
.map(|tx| {
@@ -351,7 +351,7 @@ impl<F: Field> SubCircuit<F> for TxCircuit<F> {
351351
config.load_aux_tables(layouter)?;
352352
let assigned_sig_verifs =
353353
self.sign_verify
354-
.assign(&config.sign_verify, layouter, &sign_datas, challenges)?;
354+
.assign(&config.sign_verify, layouter, &sign_data, challenges)?;
355355
self.assign_tx_table(config, layouter, assigned_sig_verifs)?;
356356
Ok(())
357357
}

zkevm-circuits/src/util/word.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Define generic Word type with utility functions
22
// Naming Conversion
3-
// - Limbs: An EVN word is 256 bits. Limbs N means split 256 into N limb. For example, N = 4, each
3+
// - Limbs: An EVEN word is 256 bits. Limbs N means split 256 into N limb. For example, N = 4, each
44
// limb is 256/4 = 64 bits
55

66
use bus_mapping::state_db::CodeDB;

0 commit comments

Comments
 (0)