Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement: add a typeos check in CI, and fix current existly typos errors. that is a TODO thing, and it's done now. #1340

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The target readers could be future developers, reviewers, and auditors. By readi

MUST: Reference the issue to resolve

### Single responsability
### Single responsibility

Is RECOMMENDED to create single responsibility commits, but not mandatory.

Expand Down
16 changes: 16 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,19 @@ jobs:
run: cargo check --all-features
- name: Cargo fmt
run: cargo fmt --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/typos@v1.22.7
with:
config: ./typos.toml
isolated: true

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ clippy: ## Run clippy checks over all workspace members
doc: ## Generate and tests docs including private items
@cargo doc --no-deps --all --document-private-items

fmt: ## Check whether the code is formated correctly
fmt: ## Check whether the code is formatted correctly
@cargo check --all-features
@cargo fmt --all -- --check

Expand Down
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 is the zkEVM circuits used in Scroll Mainnet. It was forked from PSE zkevm-
2. RLP circuit / MPT circuit / Poseidon circuit
3. multi block chunking
4. proof aggregation
5. [>99.5% compatiblity](https://circuit-release.s3.us-west-2.amazonaws.com/testool/nightly.1695216104.47e2015.html) with [official EVM test vector](https://github.com/ethereum/tests)
5. [>99.5% compatibility](https://circuit-release.s3.us-west-2.amazonaws.com/testool/nightly.1695216104.47e2015.html) with [official EVM test vector](https://github.com/ethereum/tests)
6. Many optimizations like read/write memory in word instead of byte

## Docs
Expand Down
10 changes: 5 additions & 5 deletions aggregator/src/aggregation/decoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5590,7 +5590,7 @@ mod tests {
.set_pledged_src_size(Some(raw.len() as u64))
.expect("Encoder src_size: raw.len()");

encoder.write_all(&raw).expect("Encoder wirte_all");
encoder.write_all(&raw).expect("Encoder write_all");
encoder.finish().expect("Encoder success")
};

Expand Down Expand Up @@ -5626,7 +5626,7 @@ mod tests {
.expect("Encoder src_size: raw.len()");
// include the content size to know at decode time the expected size of decoded data.

encoder.write_all(&raw).expect("Encoder wirte_all");
encoder.write_all(&raw).expect("Encoder write_all");
encoder.finish().expect("Encoder success")
};

Expand Down Expand Up @@ -5672,7 +5672,7 @@ mod tests {
.set_pledged_src_size(Some(batch_data.len() as u64))
.expect("Encoder src_size: raw.len()");

encoder.write_all(&batch_data).expect("Encoder wirte_all");
encoder.write_all(&batch_data).expect("Encoder write_all");
encoder.finish().expect("Encoder success")
};

Expand Down Expand Up @@ -5716,7 +5716,7 @@ mod tests {
.set_pledged_src_size(Some(raw.len() as u64))
.expect("Encoder src_size: raw.len()");

encoder.write_all(&raw).expect("Encoder wirte_all");
encoder.write_all(&raw).expect("Encoder write_all");
encoder.finish().expect("Encoder success")
};

Expand Down Expand Up @@ -5759,7 +5759,7 @@ mod tests {

encoder
.write_all(&multi_batch_data)
.expect("Encoder wirte_all");
.expect("Encoder write_all");
encoder.finish().expect("Encoder success")
};

Expand Down
10 changes: 5 additions & 5 deletions aggregator/src/aggregation/decoder/seq_exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ type ExportedCell<F> = AssignedCell<F, F>;

impl<F: Field> SeqExecConfig<F> {
/// Construct the sequence instruction table
/// the maxium rotation is prev(2), next(1)
/// the maximum rotation is prev(2), next(1)
pub fn configure(
meta: &mut ConstraintSystem<F>,
challenges: Expression<F>,
Expand Down Expand Up @@ -408,7 +408,7 @@ impl<F: Field> SeqExecConfig<F> {
1.expr() - s_lit_cp_phase_next.expr() - s_back_ref_phase_next.expr();
cb.condition(is_padding.expr(), |cb| {
cb.require_equal(
"padding never change once actived",
"padding never change once activated",
is_padding_next.expr(),
is_padding.expr(),
);
Expand All @@ -431,7 +431,7 @@ impl<F: Field> SeqExecConfig<F> {
]),
|cb| {
cb.require_equal(
"phase can only be actived in inst border",
"phase can only be activated in inst border",
is_inst_begin.expr(),
1.expr(),
);
Expand All @@ -445,7 +445,7 @@ impl<F: Field> SeqExecConfig<F> {
]),
|cb| {
cb.require_equal(
"phase must keep actived until block end",
"phase must keep activated until block end",
s_last_lit_cp_phase_prev.expr(),
s_last_lit_cp_phase.expr(),
);
Expand All @@ -454,7 +454,7 @@ impl<F: Field> SeqExecConfig<F> {

cb.condition(s_last_lit_cp_phase.expr(), |cb| {
cb.require_equal(
"lit cp must actived if last lit cp is actived",
"lit cp must activated if last lit cp is activated",
s_lit_cp_phase.expr_at(meta, Rotation::cur()),
1.expr(),
);
Expand Down
2 changes: 1 addition & 1 deletion aggregator/src/aggregation/decoder/tables/bitstring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ impl<const N_BYTES: usize> BitstringTable<N_BYTES> {

let mut cb = BaseConstraintBuilder::default();

// Columns that do not change in the chunk of 3 contigious bytes.
// Columns that do not change in the chunk of 3 contiguous bytes.
for col in [
config.byte_idx_1,
config.byte_idx_2,
Expand Down
4 changes: 2 additions & 2 deletions aggregator/src/aggregation/decoder/tables/fse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,7 @@ impl<const L: usize, const R: usize> FseTable<L, R> {

/// Lookup table expressions for (symbol, symbol_count) tuple check.
///
/// This check is only done on the last occurence of a particular symbol, i.e. where:
/// This check is only done on the last occurrence of a particular symbol, i.e. where:
/// - symbol_count == symbol_count_acc
pub fn table_exprs_by_symbol(&self, meta: &mut VirtualCells<Fr>) -> Vec<Expression<Fr>> {
vec![
Expand Down Expand Up @@ -1762,7 +1762,7 @@ impl FseSortedStatesTable {
// - smallest_spot does not change
// - last_baseline does not change
// - symbol_count_acc increments by +1
// - spot_acc accumlates based on the current spot
// - spot_acc accumulates based on the current spot
// - baseline_mark can transition from 0 -> 1 only once
// - baseline==0x00 if baseline_mark is set
// - baseline==baseline::prev+spot::prev if baseline_mark is not set
Expand Down
12 changes: 6 additions & 6 deletions aggregator/src/aggregation/decoder/tables/seqinst_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ impl<F: Field> ChipContext<F> {

impl<F: Field> SeqInstTable<F> {
/// The sequence count should be lookuped by parsed bitstream,
/// used the block index and value for sequnce count tag to
/// used the block index and value for sequence count tag to
/// lookup (`true`, `block_index`, 1, `value`)
/// The table would be padded by increased block index to
/// fill all rows being enabled
Expand Down Expand Up @@ -247,7 +247,7 @@ impl<F: Field> SeqInstTable<F> {
}

/// Construct the sequence instruction table
/// the maxium rotation is prev(1), next(1)
/// the maximum rotation is prev(1), next(1)
pub fn configure(meta: &mut ConstraintSystem<F>) -> Self {
let q_enabled = meta.fixed_column();
let block_index = meta.advice_column();
Expand Down Expand Up @@ -347,7 +347,7 @@ impl<F: Field> SeqInstTable<F> {
});

// so, we enforce s_beginning enabled for valid block index
meta.create_gate("border constaints", |meta| {
meta.create_gate("border constraints", |meta| {
let mut cb = BaseConstraintBuilder::default();
let s_beginning = s_beginning.expr_at(meta, Rotation::cur());

Expand Down Expand Up @@ -492,7 +492,7 @@ impl<F: Field> SeqInstTable<F> {
rep_offset_3.expr(),
);
});
// update mode 2 (offset == 2 / offet == 1 while lit_len != 0)
// update mode 2 (offset == 2 / offset == 1 while lit_len != 0)
cb.condition(ref_update_mode_2.expr(), |cb| {
cb.require_equal(
"swap 1&2 for ref 2",
Expand All @@ -510,7 +510,7 @@ impl<F: Field> SeqInstTable<F> {
rep_offset_3.expr(),
);
});
// update mode 3 (offset == 3 / offet == 2 while lit_len != 0)
// update mode 3 (offset == 3 / offset == 2 while lit_len != 0)
cb.condition(ref_update_mode_3.expr(), |cb| {
cb.require_equal(
"rotate 3-1 for ref 3",
Expand Down Expand Up @@ -554,7 +554,7 @@ impl<F: Field> SeqInstTable<F> {
)
});

// the beginning of following rows must be constrainted
// the beginning of following rows must be constrained
meta.enable_equality(block_index);
meta.enable_equality(seq_index);
meta.enable_equality(rep_offset_1);
Expand Down
2 changes: 1 addition & 1 deletion aggregator/src/aggregation/decoder/witgen/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ pub struct AddressTableRow {
}

impl AddressTableRow {
/// a debug helper, input datas in the form of example in
/// a debug helper, input data in the form of example in
/// zstd spec: https://github.com/facebook/zstd/blob/dev/doc/zstd_compression_format.md#repeat-offsets
/// i.e. [offset, literal, rep_1, rep_2, rep_3]
#[cfg(test)]
Expand Down
2 changes: 1 addition & 1 deletion aggregator/src/blob.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl<const N_SNARKS: usize> BatchData<N_SNARKS> {
// metadata bytes.
let bytes = self.to_metadata_bytes();

// accumulators represent the runnin linear combination of bytes.
// accumulators represent the running linear combination of bytes.
let accumulators_iter = self
.num_valid_chunks
.to_be_bytes()
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ On that way, we would get something like this for the Memory ops:
| `key` | `val` | `rw` | `gc` | Note |
|:------:| ------------- | ------- | ---- | ---------------------------------------- |
| `0x40` | `0` | `Write` | | Init |
| `0x40` | `0x80` | `Write` | 0 | Assume written at the begining of `code` |
| `0x40` | `0x80` | `Write` | 0 | Assume written at the beginning of `code`|
| `0x40` | `0x80` | `Read` | 4 | `56 MLOAD` |
| - | | | | |
| `0x80` | `0` | `Write` | | Init |
Expand Down
6 changes: 3 additions & 3 deletions bus-mapping/src/circuit_input_builder/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ impl From<(Word, Word, Word)> for ExpStep {
}
}

/// Event representating an exponentiation `a ^ b == d (mod 2^256)`.
/// Event representing an exponentiation `a ^ b == d (mod 2^256)`.
#[derive(Clone, Debug)]
pub struct ExpEvent {
/// Base `a` for the exponentiation.
Expand Down Expand Up @@ -1428,7 +1428,7 @@ impl EcPairingOp {
}
}

/// Event representating an exponentiation `a ^ b == d (mod m)` in precompile modexp.
/// Event representing an exponentiation `a ^ b == d (mod m)` in precompile modexp.
#[derive(Clone, Debug)]
pub struct BigModExp {
/// Base `a` for the exponentiation.
Expand All @@ -1452,7 +1452,7 @@ impl Default for BigModExp {
}
}

/// Event representating an SHA256 hash in precompile sha256.
/// Event representing an SHA256 hash in precompile sha256.
#[derive(Clone, Debug, Default)]
pub struct SHA256 {
/// input bytes
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/circuit_input_builder/input_state_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2424,7 +2424,7 @@ fn combine_copy_slot_bytes(
copy_length: usize,
src_data: &[impl Into<u8> + Clone],
dst_memory: &mut Memory,
is_memory_copy: bool, // indicates memroy --> memory copy(mcopy) type.
is_memory_copy: bool, // indicates memory --> memory copy(mcopy) type.
) -> (MemoryWordRange, MemoryWordRange, Vec<u8>) {
let mut src_range = MemoryWordRange::align_range(src_addr, copy_length);
let mut dst_range = MemoryWordRange::align_range(dst_addr, copy_length);
Expand Down
4 changes: 2 additions & 2 deletions bus-mapping/src/circuit_input_builder/tracer_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ fn tracer_call_success() {

#[test]
fn tracer_err_address_collision() {
// We do CREATE2 twice with the same parameters, with a code_creater
// We do CREATE2 twice with the same parameters, with a code_creator
// that outputs the same, which will lead to the same new
// contract address.
let code_creator = bytecode! {
Expand Down Expand Up @@ -480,7 +480,7 @@ fn tracer_err_address_collision() {

#[test]
fn tracer_create_collision_free() {
// We do CREATE twice with the same parameters, with a code_creater
// We do CREATE twice with the same parameters, with a code_creator
// that outputs not the same, which will lead to the different new
// contract address.
let code_creator = bytecode! {
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/circuit_input_builder/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ethers_core::utils::get_contract_address;

/// Precision of transaction L1 fee
pub const TX_L1_FEE_PRECISION: u64 = 1_000_000_000;
/// Extra cost as the bytes of rlped tx commited to L1 (assume to non-zero, overestimated a bit)
/// Extra cost as the bytes of rlped tx committed to L1 (assume to non-zero, overestimated a bit)
pub const TX_L1_COMMIT_EXTRA_COST: u64 = 64;

#[derive(Debug, Default)]
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/evm/opcodes/begin_end_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ pub fn gen_begin_tx_steps(state: &mut CircuitInputStateRef) -> Result<Vec<ExecSt
// since there is a bug in the prestate
// tracer: https://github.com/ethereum/go-ethereum/issues/28439
// which may also act as the data source for our statedb,
// we have to relax the constarint a bit and fix it silently
// we have to relax the constraint a bit and fix it silently
if account_code_hash_is_empty_or_zero && callee_account.nonce == 1.into() {
log::warn!(
"fix deployment nonce for {:?} silently for the prestate tracer",
Expand Down
4 changes: 2 additions & 2 deletions bus-mapping/src/evm/opcodes/callop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<const N_ARGS: usize> Opcode for CallOpcode<N_ARGS> {
state.parse_call(geth_step)?
} else {
// if precheck not ok, the call won't appear in call trace since it never happens
// we need to increase the offset and mannually set the is_success
// we need to increase the offset and manually set the is_success
state.tx_ctx.call_is_success_offset += 1;
let mut call = state.parse_call_partial(geth_step)?;
call.is_success = false;
Expand Down Expand Up @@ -185,7 +185,7 @@ impl<const N_ARGS: usize> Opcode for CallOpcode<N_ARGS> {
// read balance of caller to compare to value for insufficient_balance checking
// in circuit, also use for callcode successful case check balance is
// indeed larger than transfer value. for call opcode, it does in
// tranfer gadget implicitly.
// transfer gadget implicitly.
state.account_read(
&mut exec_step,
callee_call.caller_address,
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/evm/opcodes/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl<const IS_CREATE2: bool> Opcode for Create<IS_CREATE2> {
state.parse_call(geth_step)?
} else {
// if precheck not ok, the call won't appear in call trace since it never happens
// we need to increase the offset and mannually set the is_success
// we need to increase the offset and manually set the is_success
state.tx_ctx.call_is_success_offset += 1;
let mut call = state.parse_call_partial(geth_step)?;
call.is_success = false;
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/evm/opcodes/error_write_protection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ impl Opcode for ErrorWriteProtection {
.contains(&geth_step.op));

if geth_step.op == OpcodeId::CALL {
// get only the frist three stack elements since the third one is the value we
// get only the first three stack elements since the third one is the value we
// want to check.
for _i in 0..3 {
let _v = state.stack_pop(&mut exec_step)?;
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@
//! | `key` | `val` | `rw` | `gc` | Note |
//! |:------:| ------------- | ------- | ---- | ---------------------------------------- |
//! | `0x40` | `0` | `Write` | | Init |
//! | `0x40` | `0x80` | `Write` | 0 | Assume written at the begining of `code` |
//! | `0x40` | `0x80` | `Write` | 0 | Assume written at the beginning of `code`|
//! | `0x40` | `0x80` | `Read` | 4 | `56 MLOAD` |
//! | - | | | | |
//! | `0x80` | `0` | `Write` | | Init |
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct BlockData {
/// chain id
pub chain_id: u64,
/// history hashes contains most recent 256 block hashes in history, where
/// the lastest one is at history_hashes[history_hashes.len() - 1].
/// the latest one is at history_hashes[history_hashes.len() - 1].
pub history_hashes: Vec<Word>,
/// Block from geth
pub eth_block: eth_types::Block<eth_types::Transaction>,
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ impl RWCounter {
}
}

/// Enum used to differenciate between EVM Stack, Memory and Storage operations.
/// Enum used to differentiate between EVM Stack, Memory and Storage operations.
#[derive(Debug, Clone, PartialEq, Eq, Copy)]
pub enum Target {
/// Start is a padding operation.
Expand Down
2 changes: 1 addition & 1 deletion bus-mapping/src/operation/container.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use itertools::Itertools;
/// [`ExecStep`](crate::circuit_input_builder::ExecStep).
///
/// Finally, the container also provides the capability of retrieving all of the
/// `Stack`, `Memory` or `Storage` operations ordered according to the criterias
/// `Stack`, `Memory` or `Storage` operations ordered according to the criteria
/// they have specified.
/// That serves as a way to get an input with which is easy to work with in
/// order to construct the State proof.
Expand Down
2 changes: 1 addition & 1 deletion docs/EVM_Circuit.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ An API layer `constraint_builder` is developed on top of the backend proof syste
- rw_lookup
- ...
### split_expression (used to split high degree expression to deg 2)
### store_expression (store those splitted expressions)
### store_expression (store those split expressions)
### build
- constraints
- curr step constraints
Expand Down
Loading
Loading