diff --git a/.codespellrc b/.codespellrc new file mode 100644 index 000000000000..771985af1912 --- /dev/null +++ b/.codespellrc @@ -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 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1f1f7a13cddb..ff3dad495eab 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -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 @@ -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 diff --git a/Makefile b/Makefile index c8adf4ff9133..187de174d074 100644 --- a/Makefile +++ b/Makefile @@ -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 \ diff --git a/bin/reth/src/commands/stage/dump/hashing_account.rs b/bin/reth/src/commands/stage/dump/hashing_account.rs index 1888f0e303e7..35bbfa4d74c9 100644 --- a/bin/reth/src/commands/stage/dump/hashing_account.rs +++ b/bin/reth/src/commands/stage/dump/hashing_account.rs @@ -69,7 +69,7 @@ fn unwind_and_copy( Ok(()) } -/// Try to re-execute the stage straightaway +/// Try to re-execute the stage straight away async fn dry_run( output_provider_factory: ProviderFactory, to: u64, diff --git a/bin/reth/src/commands/stage/dump/hashing_storage.rs b/bin/reth/src/commands/stage/dump/hashing_storage.rs index 7f827b25cd7a..a7e387880682 100644 --- a/bin/reth/src/commands/stage/dump/hashing_storage.rs +++ b/bin/reth/src/commands/stage/dump/hashing_storage.rs @@ -65,7 +65,7 @@ fn unwind_and_copy( Ok(()) } -/// Try to re-execute the stage straightaway +/// Try to re-execute the stage straight away async fn dry_run( output_provider_factory: ProviderFactory, to: u64, diff --git a/bin/reth/src/commands/stage/dump/merkle.rs b/bin/reth/src/commands/stage/dump/merkle.rs index 08ac0a3aaefe..2dfd0172b8c7 100644 --- a/bin/reth/src/commands/stage/dump/merkle.rs +++ b/bin/reth/src/commands/stage/dump/merkle.rs @@ -138,7 +138,7 @@ async fn unwind_and_copy( Ok(()) } -/// Try to re-execute the stage straightaway +/// Try to re-execute the stage straight away async fn dry_run( output_provider_factory: ProviderFactory, to: u64, diff --git a/bin/reth/src/commands/test_vectors/tables.rs b/bin/reth/src/commands/test_vectors/tables.rs index 6399c81ac235..181ed0e3e3a3 100644 --- a/bin/reth/src/commands/test_vectors/tables.rs +++ b/bin/reth/src/commands/test_vectors/tables.rs @@ -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::>(( ::Parameters::default(), ::Parameters::default(), @@ -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() diff --git a/crates/engine-primitives/src/error.rs b/crates/engine-primitives/src/error.rs index d6549a516f38..f6dd3a8b7f40 100644 --- a/crates/engine-primitives/src/error.rs +++ b/crates/engine-primitives/src/error.rs @@ -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), diff --git a/crates/ethereum/engine-primitives/src/lib.rs b/crates/ethereum/engine-primitives/src/lib.rs index 6b030a9c553d..cb6d0231eed4 100644 --- a/crates/ethereum/engine-primitives/src/lib.rs +++ b/crates/ethereum/engine-primitives/src/lib.rs @@ -1,4 +1,4 @@ -//! Ethereum specifc +//! Ethereum specific #![doc( html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png", diff --git a/crates/net/ecies/src/error.rs b/crates/net/ecies/src/error.rs index d87545871fe2..64526f16d6ba 100644 --- a/crates/net/ecies/src/error.rs +++ b/crates/net/ecies/src/error.rs @@ -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, } diff --git a/crates/net/network/src/transactions/validation.rs b/crates/net/network/src/transactions/validation.rs index e508b2b2452c..9171004bde66 100644 --- a/crates/net/network/src/transactions/validation.rs +++ b/crates/net/network/src/transactions/validation.rs @@ -21,7 +21,7 @@ pub const SIGNATURE_DECODED_SIZE_BYTES: usize = mem::size_of::(); 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, diff --git a/crates/node-builder/src/components/builder.rs b/crates/node-builder/src/components/builder.rs index 6abdca96c5c0..14bdf7a4a589 100644 --- a/crates/node-builder/src/components/builder.rs +++ b/crates/node-builder/src/components/builder.rs @@ -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 diff --git a/crates/node-core/src/args/rpc_server_args.rs b/crates/node-core/src/args/rpc_server_args.rs index da3095815118..2ac48e2ba3ab 100644 --- a/crates/node-core/src/args/rpc_server_args.rs +++ b/crates/node-core/src/args/rpc_server_args.rs @@ -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 } diff --git a/crates/rpc/rpc-api/src/engine.rs b/crates/rpc/rpc-api/src/engine.rs index 9304bbc5b8b4..d320c74601d0 100644 --- a/crates/rpc/rpc-api/src/engine.rs +++ b/crates/rpc/rpc-api/src/engine.rs @@ -131,7 +131,7 @@ pub trait EngineApi { /// 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")] diff --git a/crates/rpc/rpc-api/src/ganache.rs b/crates/rpc/rpc-api/src/ganache.rs index 0156f074acee..338c914980eb 100644 --- a/crates/rpc/rpc-api/src/ganache.rs +++ b/crates/rpc/rpc-api/src/ganache.rs @@ -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; diff --git a/crates/rpc/rpc-builder/src/lib.rs b/crates/rpc/rpc-builder/src/lib.rs index 62f82b8f8bee..4b9159e2d003 100644 --- a/crates/rpc/rpc-builder/src/lib.rs +++ b/crates/rpc/rpc-builder/src/lib.rs @@ -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)] diff --git a/crates/rpc/rpc-engine-api/src/engine_api.rs b/crates/rpc/rpc-engine-api/src/engine_api.rs index be9f98832abe..eb3b1bfc7bd8 100644 --- a/crates/rpc/rpc-engine-api/src/engine_api.rs +++ b/crates/rpc/rpc-engine-api/src/engine_api.rs @@ -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( @@ -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. /// diff --git a/crates/rpc/rpc/src/eth/signer.rs b/crates/rpc/rpc/src/eth/signer.rs index b744d83efa55..578907604ea4 100644 --- a/crates/rpc/rpc/src/eth/signer.rs +++ b/crates/rpc/rpc/src/eth/signer.rs @@ -53,7 +53,7 @@ impl DevSigner { /// Generates a random dev signer which satisfies [EthSigner] trait pub(crate) fn random() -> Box { 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 diff --git a/crates/rpc/rpc/src/lib.rs b/crates/rpc/rpc/src/lib.rs index fe5e2a97d733..c75fa9b6be12 100644 --- a/crates/rpc/rpc/src/lib.rs +++ b/crates/rpc/rpc/src/lib.rs @@ -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. diff --git a/crates/static-file/README.md b/crates/static-file/README.md index b6eb385dd9ef..3aab25a97ad9 100644 --- a/crates/static-file/README.md +++ b/crates/static-file/README.md @@ -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. diff --git a/crates/storage/db/benches/hash_keys.rs b/crates/storage/db/benches/hash_keys.rs index 5376bf5040cc..ee21883fea0e 100644 --- a/crates/storage/db/benches/hash_keys.rs +++ b/crates/storage/db/benches/hash_keys.rs @@ -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::>(( ::Parameters::default(), ::Parameters::default(), @@ -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())); diff --git a/crates/storage/db/src/abstraction/common.rs b/crates/storage/db/src/abstraction/common.rs index 9bce16e397d2..eef41293527d 100644 --- a/crates/storage/db/src/abstraction/common.rs +++ b/crates/storage/db/src/abstraction/common.rs @@ -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 Sealed for &DB {} diff --git a/crates/storage/libmdbx-rs/src/environment.rs b/crates/storage/libmdbx-rs/src/environment.rs index 31430fb992d1..218196c49e68 100644 --- a/crates/storage/libmdbx-rs/src/environment.rs +++ b/crates/storage/libmdbx-rs/src/environment.rs @@ -501,7 +501,7 @@ impl Default for Geometry { /// /// # 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. diff --git a/crates/storage/nippy-jar/src/lib.rs b/crates/storage/nippy-jar/src/lib.rs index 4d311f2732c3..cc4f2b0f5147 100644 --- a/crates/storage/nippy-jar/src/lib.rs +++ b/crates/storage/nippy-jar/src/lib.rs @@ -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 { diff --git a/crates/storage/provider/src/providers/state/historical.rs b/crates/storage/provider/src/providers/state/historical.rs index a2dba78a0413..e87be25c969f 100644 --- a/crates/storage/provider/src/providers/state/historical.rs +++ b/crates/storage/provider/src/providers/state/historical.rs @@ -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" ); } diff --git a/crates/storage/provider/src/traits/transactions.rs b/crates/storage/provider/src/traits/transactions.rs index 9041593b552e..3e798bb419c6 100644 --- a/crates/storage/provider/src/traits/transactions.rs +++ b/crates/storage/provider/src/traits/transactions.rs @@ -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>; - /// 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>; /// Get transaction by id without computing the hash. diff --git a/crates/transaction-pool/src/pool/pending.rs b/crates/transaction-pool/src/pool/pending.rs index 9703213237d1..7e733a6593c9 100644 --- a/crates/transaction-pool/src/pool/pending.rs +++ b/crates/transaction-pool/src/pool/pending.rs @@ -399,7 +399,7 @@ impl PendingPool { 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 diff --git a/crates/transaction-pool/src/pool/txpool.rs b/crates/transaction-pool/src/pool/txpool.rs index dfc63c921ebc..cdd897448e8e 100644 --- a/crates/transaction-pool/src/pool/txpool.rs +++ b/crates/transaction-pool/src/pool/txpool.rs @@ -1766,8 +1766,8 @@ pub(crate) struct PoolInternalTransaction { pub(crate) transaction: Arc>, /// 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. ///