Skip to content

Commit

Permalink
ci: adds cargo spellcheck (#95)
Browse files Browse the repository at this point in the history
* ci: adds cargo spellcheck

* indentation

* fix config filetype

* fix(deps): update rust crate syn to 2.0.28 (#106)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate serde to 1.0.183 (#105)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate quote to 1.0.32 (#104)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate async-trait to 0.1.73 (#107)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate thiserror to 1.0.44 (#108)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>

* fix(deps): update rust crate proc-macro2 to 1.0.66 (#103)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>

* fix(deps): update rust crate tracing to 0.1.37 (#110)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate toml to 0.7.6 (#109)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate clap to 4.3.21 (#113)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate itertools to 0.11.0 (#114)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate url to 2.4.0 (#116)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate tokio to 1.30.0 (#115)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix(deps): update rust crate tokio to 1.31.0 (#117)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update actions/checkout action to v3 (#118)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update docker/build-push-action action to v2.10.0 (#111)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update docker/build-push-action action to v4 (#119)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* chore(deps): update docker/setup-buildx-action action to v2 (#120)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* fix reviews

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
  • Loading branch information
montekki and renovate[bot] committed Aug 14, 2023
1 parent a861023 commit 721f651
Show file tree
Hide file tree
Showing 12 changed files with 158 additions and 31 deletions.
69 changes: 69 additions & 0 deletions .github/spellcheck/finalizer.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Project settings where a Cargo.toml exists and is passed
# ${CARGO_MANIFEST_DIR}/.config/spellcheck.toml

# Also take into account developer comments
dev_comments = false

# Skip the README.md file as defined in the cargo manifest
skip_readme = false

[Hunspell]
# lang and name of `.dic` file
lang = "en_US"
# OS specific additives
# Linux: [ /usr/share/myspell ]
# Windows: []
# macOS [ /home/alice/Libraries/hunspell, /Libraries/hunspell ]

# Additional search paths, which take presedence over the default
# os specific search dirs, searched in order, defaults last
search_dirs = ["."]

# Adds additional dictionaries, can be specified as
# absolute paths or relative in the search dirs (in this order).
# Relative paths are resolved relative to the configuration file
# which is used.
# Refer to `man 5 hunspell`
# or https://www.systutorials.com/docs/linux/man/4-hunspell/#lbAE
# on how to define a custom dictionary file.
extra_dictionaries = ["finalizer.dic"]

# If set to `true`, the OS specific default search paths
# are skipped and only explicitly specified ones are used.
skip_os_lookups = false

# Use the builtin dictionaries if none were found in
# in the configured lookup paths.
# Usually combined with `skip_os_lookups=true`
# to enforce the `builtin` usage for consistent
# results across distributions and CI runs.
# Setting this will still use the dictionaries
# specified in `extra_dictionaries = [..]`
# for topic specific lingo.
use_builtin = true


[Hunspell.quirks]
# Transforms words that are provided by the tokenizer
# into word fragments based on the capture groups which are to
# be checked.
# If no capture groups are present, the matched word is whitelisted.
transform_regex = ["^'([^\\s])'$", "^[0-9]+x$"]
# Accepts `alphabeta` variants if the checker provides a replacement suggestion
# of `alpha-beta`.
allow_concatenation = true
# And the counterpart, which accepts words with dashes, when the suggestion has
# recommendations without the dashes. This is less common.
allow_dashed = false

[NlpRules]
# Allows the user to override the default included
# exports of LanguageTool, with other custom
# languages

# override_rules = "/path/to/rules_binencoded.bin"
# override_tokenizer = "/path/to/tokenizer_binencoded.bin"

[Reflow]
# Reflows doc comments to adhere to a given maximum line width limit.
max_line_length = 80
34 changes: 34 additions & 0 deletions .github/spellcheck/finalizer.dic
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
42
ABI
vlog
L2
L1
l1
WS
env
url
ERC20
Finalizer
Backoff
middleware
Postgres
API
APIs
async
websocket
struct
TOML
config
finalizer
boolean
timestamp
H160
zkSync
AccessList
miniblock
merkle
eth
Ethereum
deployer
RPC
tx
24 changes: 24 additions & 0 deletions .github/workflows/check-spelling.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Spelling

on:
push:
branches:
- main
pull_request:

env:
CARGO_TERM_COLOR: always

jobs:
spellcheck:
runs-on: ubuntu-latest
steps:
- name: Install cargo-spellcheck
uses: taiki-e/install-action@v2
with:
tool: cargo-spellcheck

- uses: actions/checkout@v3

- name: Run cargo-spellcheck
run: cargo spellcheck --cfg=.github/spellcheck/finalizer.cfg --code 1
2 changes: 1 addition & 1 deletion chain-events/src/block_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl BlockEvents {
impl BlockEvents {
/// A convenience function that listens for all `Block`-related and sends them to the user.
///
/// `ethers` apis have two approaches to querying events from chain:
/// `ethers` APIs have two approaches to querying events from chain:
/// 1. Listen to *all* types of events (will generate a less-performant code)
/// 2. Listen to a *single* type of event
///
Expand Down
2 changes: 1 addition & 1 deletion chain-events/src/l2_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ impl L2EventsListener {
///
/// # Arguments
///
/// * `middleware`: THe middleware to perform requests with.
/// * `middleware`: The middleware to perform requests with.
pub fn new(url: &str, l2_erc20_bridge_addr: Address, mut tokens: HashSet<Address>) -> Self {
tokens.insert(ETH_TOKEN_ADDRESS);
tokens.insert(ETH_ADDRESS);
Expand Down
8 changes: 4 additions & 4 deletions chain-events/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ impl From<L2TokenInitEvent> for L2Event {
/// `BridgeInitialize` event.
#[derive(Debug)]
pub struct L2TokenInitEvent {
/// Address of the token on l1
/// Address of the token on L1
pub l1_token_address: Address,

/// Address of the token on l2
/// Address of the token on L2
pub l2_token_address: Address,

/// Name of the token
Expand All @@ -66,10 +66,10 @@ pub struct L2TokenInitEvent {
/// Decimals
pub decimals: u8,

/// Number of miniblock on l2 where this deployment happened
/// Number of miniblock on L2 where this deployment happened
pub l2_block_number: u64,

/// Transaction on l2 in which the event happened
/// Transaction on L2 in which the event happened
pub initialization_transaction: H256,
}

Expand Down
8 changes: 4 additions & 4 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ pub const ETH_TOKEN_ADDRESS: Address = H160([
/// Eth address
pub const ETH_ADDRESS: Address = Address::zero();

/// Address of ethereum L1 messenger
/// Address of Ethereum L1 messenger
pub const L1_MESSENGER_ADDRESS: Address = H160([
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x80, 0x08,
Expand Down Expand Up @@ -95,7 +95,7 @@ pub struct WithdrawalKey {
pub event_index_in_tx: u32,
}

/// Withdrawal params
/// Withdrawal parameters
#[derive(Debug, Clone)]
pub struct WithdrawalParams {
/// Hash of the withdrawal transaction.
Expand All @@ -109,7 +109,7 @@ pub struct WithdrawalParams {
/// A monotonically increasing counter for every withdrawal.
pub id: u64,

/// Block number on l2 withdrawal transaction happened in.
/// Block number on L2 withdrawal transaction happened in.
pub l2_block_number: u64,

/// The number of batch on L1
Expand Down Expand Up @@ -141,7 +141,7 @@ impl WithdrawalParams {
}
}

/// A middleware for interacting with Zksync node.
/// A middleware for interacting with zkSync node.
#[async_trait]
#[auto_impl(&, Arc, Box)]
pub trait ZksyncMiddleware: Middleware {
Expand Down
8 changes: 4 additions & 4 deletions client/src/zksync_contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ impl std::fmt::Display for BlockEvent {
}
}

/// A wrapper to implement a conpressed ABI encoding used in the project.
/// A wrapper to implement a compressed ABI encoding used in the project.
#[derive(Default, Debug)]
pub struct L2LogCompresed(pub codegen::L2Log);

Expand Down Expand Up @@ -141,13 +141,13 @@ impl AbiDecode for L2LogCompresed {

const L2_TO_L1_LOG_SERIALIZED_SIZE: usize = 88;

/// Information about withdrawals from L2ToL1 logs.
/// Information about withdrawals from [`L2ToL1`] logs.
#[derive(Debug)]
pub struct L2ToL1Event {
/// L1 address of the token
pub token: Address,

/// Recepient of the withdrawal.
/// Recipient of the withdrawal.
pub to: Address,

/// Amount of the withdrawal.
Expand All @@ -163,7 +163,7 @@ pub struct L2ToL1Event {
pub tx_number_in_block: u16,
}

/// Given a [`CommitBlocksCall`] parse all withdrawal events from L2ToL1 logs.
/// Given a [`CommitBlocksCall`] parse all withdrawal events from [`L2ToL1`] logs.
// TODO: rewrite in `nom`.
pub fn parse_withdrawal_events_l1(
call: &CommitBlocksCall,
Expand Down
10 changes: 5 additions & 5 deletions client/src/zksync_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub struct BaseSystemContractsHashes {
pub default_aa: H256,
}

/// A struct with the proof for the L2->L1 log in a specific block.
/// A struct with the proof for the L2 to L1 log in a specific block.
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct L2ToL1LogProof {
Expand Down Expand Up @@ -54,12 +54,12 @@ pub struct TransactionReceipt {
pub l1_batch_number: Option<U64>,
/// Sender
/// Note: default address if the client did not return this value
/// (maintains backwards compatibility for <= 0.7.0 when this field was missing)
/// (maintains backwards compatibility for `<= 0.7.0` when this field was missing)
#[serde(default)]
pub from: Address,
/// Recipient (None when contract creation)
/// Note: Also `None` if the client did not return this value
/// (maintains backwards compatibility for <= 0.7.0 when this field was missing)
/// (maintains backwards compatibility for `<= 0.7.0` when this field was missing)
#[serde(default)]
pub to: Option<Address>,
/// Cumulative gas used within the block after this was executed.
Expand Down Expand Up @@ -183,10 +183,10 @@ pub struct WithdrawalEvent {
/// Number of the L2 block this withdrawal happened in.
pub block_number: u64,

/// Address of the transfered token
/// Address of the transferred token
pub token: Address,

/// The amount transfered.
/// The amount transferred.
pub amount: U256,
}

Expand Down
2 changes: 1 addition & 1 deletion ethers-log-decode/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use syn::{parse_macro_input, spanned::Spanned, Data, DeriveInput, Error, Fields}

/// Derives the [`EthLogDecode`] trait
///
/// Derivation is only possible for enums with a single-value unnamed variants.
/// Derivation is only possible for `enum`s with a single-value unnamed variants.
///
/// # Examples:
///
Expand Down
12 changes: 6 additions & 6 deletions storage/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use utils::u256_to_big_decimal;
pub use error::{Error, Result};

/// A convenience struct that couples together [`WithdrawalEvent`]
/// with index in tx and boolean is_finalized value
/// with index in tx and boolean `is_finalized` value
#[derive(Debug)]
pub struct StoredWithdrawal {
/// Withdrawal event
Expand Down Expand Up @@ -74,7 +74,7 @@ pub async fn committed_new_batch(
Ok(())
}

/// Request the number of L1 block this withdrawal was commited in.
/// Request the number of L1 block this withdrawal was committed in.
pub async fn withdrawal_committed_in_block(
conn: &mut PgConnection,
tx_hash: H256,
Expand Down Expand Up @@ -249,7 +249,7 @@ pub async fn executed_new_batch(
/// # Arguments
///
/// * `conn`: Connection to the Postgres DB
/// * `events`: Withdrawal events grouped with their indices in transcation.
/// * `events`: Withdrawal events grouped with their indices in transaction.
pub async fn add_withdrawals(pool: &PgPool, events: &[StoredWithdrawal]) -> Result<()> {
let mut tx_hashes = Vec::with_capacity(events.len());
let mut block_numbers = Vec::with_capacity(events.len());
Expand Down Expand Up @@ -362,7 +362,7 @@ pub async fn last_l1_block_seen(conn: &mut PgConnection) -> Result<Option<u64>>
Ok(res)
}

/// Get the last block seen for the l2_to_l1_events set
/// Get the last block seen for the `l2_to_l1_events` set
pub async fn last_l2_to_l1_events_block_seen(conn: &mut PgConnection) -> Result<Option<u64>> {
let started_at = Instant::now();

Expand Down Expand Up @@ -469,7 +469,7 @@ pub async fn l2_to_l1_events(pool: &PgPool, events: &[L2ToL1Event]) -> Result<()
Ok(())
}

/// Get addresses of known tokens on L2 + last seen block.
/// Get addresses of known tokens on L2 and the last seen block.
pub async fn get_tokens(pool: &PgPool) -> Result<(Vec<Address>, u64)> {
let last_l2_block_seen = sqlx::query!(
"
Expand Down Expand Up @@ -501,7 +501,7 @@ pub async fn get_tokens(pool: &PgPool) -> Result<(Vec<Address>, u64)> {
Ok((tokens, last_l2_block_seen as u64))
}

/// Insert a token initalization event into the DB.
/// Insert a token initialization event into the DB.
pub async fn add_token(pool: &PgPool, token: &L2TokenInitEvent) -> Result<()> {
sqlx::query!(
"
Expand Down
10 changes: 5 additions & 5 deletions vlog/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#![deny(unused_crate_dependencies)]

//! A set of logging macros that print not only timestamp and log level,
//! but also filename, line and column.
//! but also file name, line and column.
//!
//! They behave just like usual tracing::warn, tracing::info, etc.
//! For warn and error macros we are adding file line and column to tracing variables
//!
//! The format of the logs in stdout can be `plain` or` json` and is set by the `MISC_LOG_FORMAT` env variable.
//! The format of the logs in `stdout` can be `plain` or `json` and is set by the `MISC_LOG_FORMAT` env variable.
//!
//! Full documentation for the `tracing` crate here https://docs.rs/tracing/
//! Full documentation for the `tracing` crate here <https://docs.rs/tracing/>
//!
//! Integration with sentry for catching errors and react on them immediately
//! https://docs.sentry.io/platforms/rust/
//! <https://docs.sentry.io/platforms/rust/>
//!

use std::{borrow::Cow, str::FromStr};
Expand Down Expand Up @@ -146,7 +146,7 @@ pub const DEFAULT_SAMPLING_RATIO: f64 = 0.1;
///
/// If the sentry URL is provided via an environment variable, this function will also initialize sentry.
/// Returns a sentry client guard. The full description can be found in the official documentation:
/// https://docs.sentry.io/platforms/rust/#configure
/// <https://docs.sentry.io/platforms/rust/#configure>
#[must_use]
pub fn init() -> Option<ClientInitGuard> {
let log_format = std::env::var("MISC_LOG_FORMAT").unwrap_or_else(|_| "plain".to_string());
Expand Down

0 comments on commit 721f651

Please sign in to comment.