Skip to content

Commit

Permalink
chore(github): use codespell to inspect and correct spelling issues (p…
Browse files Browse the repository at this point in the history
…aradigmxyz#7775)

Signed-off-by: jsvisa <[email protected]>
Co-authored-by: Matthias Seitz <[email protected]>
  • Loading branch information
jsvisa and mattsse authored Apr 23, 2024
1 parent 665e67e commit 7a59388
Show file tree
Hide file tree
Showing 28 changed files with 55 additions and 34 deletions.
3 changes: 3 additions & 0 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[codespell]
skip = .git,target,./crates/storage/libmdbx-rs/mdbx-sys/libmdbx,Cargo.toml,Cargo.lock
ignore-words-list = crate,ser,ratatui
8 changes: 7 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ jobs:
components: rustfmt
- run: cargo fmt --all --check

codespell:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: codespell-project/actions-codespell@v2

grafana:
runs-on: ubuntu-latest
timeout-minutes: 30
Expand All @@ -124,7 +130,7 @@ jobs:
name: lint success
runs-on: ubuntu-latest
if: always()
needs: [clippy-binaries, clippy, crate-checks, docs, fmt, grafana]
needs: [clippy-binaries, clippy, crate-checks, docs, fmt, codespell, grafana]
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -303,11 +303,21 @@ lint-other-targets:
--all-features \
-- -D warnings

lint-codespell: ensure-codespell
codespell

ensure-codespell:
@if ! command -v codespell &> /dev/null; then \
echo "codespell not found. Please install it by running the command `pip install codespell` or refer to the following link for more information: https://github.com/codespell-project/codespell" \
exit 1; \
fi

lint:
make fmt && \
make lint-reth && \
make lint-op-reth && \
make lint-other-targets
make lint-other-targets \
make lint-codespell

fix-lint-reth:
cargo +nightly clippy \
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/dump/hashing_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn unwind_and_copy<DB: Database>(
Ok(())
}

/// Try to re-execute the stage straightaway
/// Try to re-execute the stage straight away
async fn dry_run<DB: Database>(
output_provider_factory: ProviderFactory<DB>,
to: u64,
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/dump/hashing_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fn unwind_and_copy<DB: Database>(
Ok(())
}

/// Try to re-execute the stage straightaway
/// Try to re-execute the stage straight away
async fn dry_run<DB: Database>(
output_provider_factory: ProviderFactory<DB>,
to: u64,
Expand Down
2 changes: 1 addition & 1 deletion bin/reth/src/commands/stage/dump/merkle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ async fn unwind_and_copy<DB: Database>(
Ok(())
}

/// Try to re-execute the stage straightaway
/// Try to re-execute the stage straight away
async fn dry_run<DB: Database>(
output_provider_factory: ProviderFactory<DB>,
to: u64,
Expand Down
4 changes: 2 additions & 2 deletions bin/reth/src/commands/test_vectors/tables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where
{
let mut rows = vec![];
let mut seen_keys = HashSet::new();
let strat = proptest::collection::vec(
let strategy = proptest::collection::vec(
any_with::<TableRow<T>>((
<T::Key as Arbitrary>::Parameters::default(),
<T::Value as Arbitrary>::Parameters::default(),
Expand All @@ -94,7 +94,7 @@ where
while rows.len() < per_table {
// Generate all `per_table` rows: (Key, Value)
rows.extend(
&mut strat
&mut strategy
.new_tree(runner)
.map_err(|e| eyre::eyre!("{e}"))?
.current()
Expand Down
6 changes: 4 additions & 2 deletions crates/engine-primitives/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ use thiserror::Error;
/// both execution payloads and forkchoice update attributes with respect to a method version.
#[derive(Error, Debug)]
pub enum EngineObjectValidationError {
/// Thrown when the underlying validation error occured while validating an `ExecutionPayload`.
/// Thrown when the underlying validation error occurred while validating an
/// `ExecutionPayload`.
#[error("Payload validation error: {0}")]
Payload(VersionSpecificValidationError),

/// Thrown when the underlying validation error occured while validating a `PayloadAttributes`.
/// Thrown when the underlying validation error occurred while validating a
/// `PayloadAttributes`.
#[error("Payload attributes validation error: {0}")]
PayloadAttributes(VersionSpecificValidationError),

Expand Down
2 changes: 1 addition & 1 deletion crates/ethereum/engine-primitives/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//! Ethereum specifc
//! Ethereum specific
#![doc(
html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
Expand Down
4 changes: 2 additions & 2 deletions crates/net/ecies/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ pub enum ECIESErrorImpl {
/// a message from the (partially filled) buffer.
#[error("stream closed due to not being readable")]
UnreadableStream,
// Error when data is not recieved from peer for a prolonged period.
#[error("never recieved data from remote peer")]
// Error when data is not received from peer for a prolonged period.
#[error("never received data from remote peer")]
StreamTimeout,
}

Expand Down
2 changes: 1 addition & 1 deletion crates/net/network/src/transactions/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub const SIGNATURE_DECODED_SIZE_BYTES: usize = mem::size_of::<Signature>();
pub trait ValidateTx68 {
/// Validates a [`NewPooledTransactionHashes68`](reth_eth_wire::NewPooledTransactionHashes68)
/// entry. Returns [`ValidationOutcome`] which signals to the caller whether to fetch the
/// transaction or wether to drop it, and whether the sender of the announcement should be
/// transaction or to drop it, and whether the sender of the announcement should be
/// penalized.
fn should_fetch(
&self,
Expand Down
2 changes: 1 addition & 1 deletion crates/node-builder/src/components/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl Default for ComponentsBuilder<(), (), (), ()> {

/// A type that configures all the customizable components of the node and knows how to build them.
///
/// Implementors of this trait are responsible for building all the components of the node: See
/// Implementers of this trait are responsible for building all the components of the node: See
/// [NodeComponents].
///
/// The [ComponentsBuilder] is a generic implementation of this trait that can be used to customize
Expand Down
2 changes: 1 addition & 1 deletion crates/node-core/src/args/rpc_server_args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ impl RpcServerArgs {

impl RethRpcConfig for RpcServerArgs {
fn is_ipc_enabled(&self) -> bool {
// By default IPC is enabled therefor it is enabled if the `ipcdisable` is false.
// By default IPC is enabled therefore it is enabled if the `ipcdisable` is false.
!self.ipcdisable
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ pub trait EngineApi<Engine: EngineTypes> {
/// layer p2p specification, meaning the input should be treated as untrusted or potentially
/// adversarial.
///
/// Implementors should take care when acting on the input to this method, specifically
/// Implementers should take care when acting on the input to this method, specifically
/// ensuring that the range is limited properly, and that the range boundaries are computed
/// correctly and without panics.
#[method(name = "getPayloadBodiesByRangeV1")]
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-api/src/ganache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ pub trait GanacheApi {
/// is the snapshot id to revert to. This deletes the given snapshot, as well as any snapshots
/// taken after (e.g.: reverting to id 0x1 will delete snapshots with ids 0x1, 0x2, etc.).
///
/// Reutnrs `true` if a snapshot was reverted, otherwise `false`.
/// Returns `true` if a snapshot was reverted, otherwise `false`.
#[method(name = "revert")]
async fn evm_revert(&self, snapshot_id: U256) -> RpcResult<bool>;

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc-builder/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -717,7 +717,7 @@ impl RpcModuleSelection {

/// Creates a new [RpcModule] based on the configured reth modules.
///
/// Note: This will always create new instance of the module handlers and is therefor only
/// Note: This will always create new instance of the module handlers and is therefore only
/// recommended for launching standalone transports. If multiple transports need to be
/// configured it's recommended to use the [RpcModuleBuilder].
#[allow(clippy::too_many_arguments)]
Expand Down
4 changes: 2 additions & 2 deletions crates/rpc/rpc-engine-api/src/engine_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ where
/// layer p2p specification, meaning the input should be treated as untrusted or potentially
/// adversarial.
///
/// Implementors should take care when acting on the input to this method, specifically
/// Implementers should take care when acting on the input to this method, specifically
/// ensuring that the range is limited properly, and that the range boundaries are computed
/// correctly and without panics.
pub async fn get_payload_bodies_by_range(
Expand Down Expand Up @@ -661,7 +661,7 @@ where
/// layer p2p specification, meaning the input should be treated as untrusted or potentially
/// adversarial.
///
/// Implementors should take care when acting on the input to this method, specifically
/// Implementers should take care when acting on the input to this method, specifically
/// ensuring that the range is limited properly, and that the range boundaries are computed
/// correctly and without panics.
///
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/signer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ impl DevSigner {
/// Generates a random dev signer which satisfies [EthSigner] trait
pub(crate) fn random() -> Box<dyn EthSigner> {
let mut signers = Self::random_signers(1);
signers.pop().expect("expect to generate at leas one signer")
signers.pop().expect("expect to generate at least one signer")
}

/// Generates provided number of random dev signers
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
//!
//! To avoid this, all blocking or CPU intensive handlers must be spawned to a separate task. See
//! the [EthApi] handler implementations for examples. The rpc-api traits make no use of the
//! available jsonrpsee `blocking` attribute to give implementors more freedom because the
//! available jsonrpsee `blocking` attribute to give implementers more freedom because the
//! `blocking` attribute and async handlers are mutually exclusive. However, as mentioned above, a
//! lot of handlers make use of async functions, caching for example, but are also using blocking
//! disk-io, hence these calls are spawned as futures to a blocking task manually.
Expand Down
2 changes: 1 addition & 1 deletion crates/static-file/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ In descending order of abstraction hierarchy:

[`StaticFileProducer`](../../crates/static-file/src/static_file_producer.rs#L25): A `reth` [hook](../../crates/consensus/beacon/src/engine/hooks/static_file.rs) service that when triggered, **copies** finalized data from the database to the latest static file. Upon completion, it updates the internal index at `StaticFileProvider` with the new highest block and transaction on each specific segment.

[`StaticFileProvider`](../../crates/storage/provider/src/providers/static_file/manager.rs#L44) A provider similar to `DatabaseProvider`, **managing all existing static_file files** and selecting the optimal one (by range and segment type) to fulfill a request. **A single instance is shared across all components and should be instantiated only once within `ProviderFactory`**. An immutable reference is given everytime `ProviderFactory` creates a new `DatabaseProvider`.
[`StaticFileProvider`](../../crates/storage/provider/src/providers/static_file/manager.rs#L44) A provider similar to `DatabaseProvider`, **managing all existing static_file files** and selecting the optimal one (by range and segment type) to fulfill a request. **A single instance is shared across all components and should be instantiated only once within `ProviderFactory`**. An immutable reference is given every time `ProviderFactory` creates a new `DatabaseProvider`.

[`StaticFileJarProvider`](../../crates/storage/provider/src/providers/static_file/jar.rs#L42) A provider similar to `DatabaseProvider` that provides access to a **single static file segment data** one a specific block range.

Expand Down
6 changes: 3 additions & 3 deletions crates/storage/db/benches/hash_keys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ where
T::Key: std::hash::Hash + Arbitrary,
T::Value: Arbitrary,
{
let strat = proptest::collection::vec(
let strategy = proptest::collection::vec(
any_with::<TableRow<T>>((
<T::Key as Arbitrary>::Parameters::default(),
<T::Value as Arbitrary>::Parameters::default(),
Expand All @@ -147,8 +147,8 @@ where
.boxed();

let mut runner = TestRunner::new(ProptestConfig::default());
let mut preload = strat.new_tree(&mut runner).unwrap().current();
let mut input = strat.new_tree(&mut runner).unwrap().current();
let mut preload = strategy.new_tree(&mut runner).unwrap().current();
let mut input = strategy.new_tree(&mut runner).unwrap().current();

let mut unique_keys = HashSet::new();
preload.retain(|(k, _)| unique_keys.insert(k.clone()));
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/db/src/abstraction/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ mod sealed {
use crate::{database::Database, mock::DatabaseMock, DatabaseEnv};
use std::sync::Arc;

/// Sealed trait to limit the implementors of the Database trait.
/// Sealed trait to limit the implementers of the Database trait.
pub trait Sealed: Sized {}

impl<DB: Database> Sealed for &DB {}
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/libmdbx-rs/src/environment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ impl<R> Default for Geometry<R> {
///
/// # Arguments
///
/// * `process_id` – A proceess id of the reader process.
/// * `process_id` – A process id of the reader process.
/// * `thread_id` – A thread id of the reader thread.
/// * `read_txn_id` – An oldest read transaction number on which stalled.
/// * `gap` – A lag from the last committed txn.
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/nippy-jar/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ mod tests {
let num_rows = 2;

// (missing_offsets, expected number of rows)
// If a row wasnt fully pruned, then it should clear it up as well
// If a row wasn't fully pruned, then it should clear it up as well
let missing_offsets_scenarios = [(1, 1), (2, 1), (3, 0)];

for (missing_offsets, expected_rows) in missing_offsets_scenarios {
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/providers/state/historical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ impl<'b, TX: DbTx> HistoricalStateProviderRef<'b, TX> {
tracing::warn!(
target: "provider::historical_sp",
target = self.block_number,
"Attempt to calculate state root for an old block might result in OOM, tread carefully"
"Attempt to calculate state root for an old block might result in OOM, treat carefully"
);
}

Expand Down
2 changes: 1 addition & 1 deletion crates/storage/provider/src/traits/transactions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ pub trait TransactionsProvider: BlockNumReader + Send + Sync {
/// Returns None if the transaction is not found.
fn transaction_id(&self, tx_hash: TxHash) -> ProviderResult<Option<TxNumber>>;

/// Get transaction by id, computes hash everytime so more expensive.
/// Get transaction by id, computes hash every time so more expensive.
fn transaction_by_id(&self, id: TxNumber) -> ProviderResult<Option<TransactionSigned>>;

/// Get transaction by id without computing the hash.
Expand Down
2 changes: 1 addition & 1 deletion crates/transaction-pool/src/pool/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ impl<T: TransactionOrdering> PendingPool<T> {
unique_senders = self.highest_nonces.len();
non_local_senders -= unique_removed;

// we can re-use the temp array
// we can reuse the temp array
removed.clear();

// loop through the highest nonces set, removing transactions until we reach the limit
Expand Down
4 changes: 2 additions & 2 deletions crates/transaction-pool/src/pool/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1766,8 +1766,8 @@ pub(crate) struct PoolInternalTransaction<T: PoolTransaction> {
pub(crate) transaction: Arc<ValidPoolTransaction<T>>,
/// The `SubPool` that currently contains this transaction.
pub(crate) subpool: SubPool,
/// Keeps track of the current state of the transaction and therefor in which subpool it should
/// reside
/// Keeps track of the current state of the transaction and therefore in which subpool it
/// should reside
pub(crate) state: TxState,
/// The total cost all transactions before this transaction.
///
Expand Down

0 comments on commit 7a59388

Please sign in to comment.