chore: clippy happy (#8362)

Co-authored-by: Alexey Shekhirin <a.shekhirin@gmail.com>
This commit is contained in:
Matthias Seitz
2024-05-23 13:24:20 +02:00
committed by GitHub
parent 155876d28c
commit 4250c33da1
28 changed files with 70 additions and 76 deletions

View File

@ -105,7 +105,7 @@ rust.missing_debug_implementations = "warn"
rust.missing_docs = "warn"
rust.unreachable_pub = "warn"
rust.unused_must_use = "deny"
rust.rust_2018_idioms = "deny"
rust.rust_2018_idioms = { level = "deny", priority = -1 }
rustdoc.all = "warn"
[workspace.lints.clippy]

View File

@ -413,9 +413,9 @@ fix-lint-other-targets:
-- -D warnings
fix-lint:
make lint-reth && \
make lint-op-reth && \
make lint-other-targets && \
make fix-lint-reth && \
make fix-lint-op-reth && \
make fix-lint-other-targets && \
make fmt
.PHONY: rustdocs

View File

@ -377,7 +377,7 @@ impl Command {
let max_widths = table.column_max_content_widths();
let mut separator = Row::new();
for width in max_widths {
separator.add_cell(Cell::new(&"-".repeat(width as usize)));
separator.add_cell(Cell::new("-".repeat(width as usize)));
}
table.add_row(separator);

View File

@ -307,7 +307,7 @@ where
*key_value.0
} else {
debug!(target: "blockchain_tree", ?chain_id, "No blockhashes stored");
return None;
return None
};
let canonical_chain = canonical_chain
.iter()

View File

@ -78,10 +78,10 @@ impl<DB: Database + 'static> PruneHook<DB> {
/// This will try to spawn the pruner if it is idle:
/// 1. Check if pruning is needed through [Pruner::is_pruning_needed].
/// 2.
/// 1. If pruning is needed, pass tip block number to the [Pruner::run] and spawn it in a
///
/// 2.1. If pruning is needed, pass tip block number to the [Pruner::run] and spawn it in a
/// separate task. Set pruner state to [PrunerState::Running].
/// 2. If pruning is not needed, set pruner state back to [PrunerState::Idle].
/// 2.2. If pruning is not needed, set pruner state back to [PrunerState::Idle].
///
/// If pruner is already running, do nothing.
fn try_spawn_pruner(&mut self, tip_block_number: BlockNumber) -> Option<EngineHookEvent> {

View File

@ -71,12 +71,12 @@ impl<DB: Database + 'static> StaticFileHook<DB> {
/// 1. Check if producing static files is needed through
/// [StaticFileProducer::get_static_file_targets](reth_static_file::StaticFileProducerInner::get_static_file_targets)
/// and then [StaticFileTargets::any](reth_static_file::StaticFileTargets::any).
/// 2.
/// 1. If producing static files is needed, pass static file request to the
/// [StaticFileProducer::run](reth_static_file::StaticFileProducerInner::run) and spawn
/// it in a separate task. Set static file producer state to
///
/// 2.1. If producing static files is needed, pass static file request to the
/// [StaticFileProducer::run](reth_static_file::StaticFileProducerInner::run) and
/// spawn it in a separate task. Set static file producer state to
/// [StaticFileProducerState::Running].
/// 2. If producing static files is not needed, set static file producer state back to
/// 2.2. If producing static files is not needed, set static file producer state back to
/// [StaticFileProducerState::Idle].
///
/// If static_file_producer is already running, do nothing.

View File

@ -1103,8 +1103,8 @@ where
/// - invalid extra data
/// - invalid transactions
/// - incorrect hash
/// - the versioned hashes passed with the payload do not exactly match transaction
/// versioned hashes
/// - the versioned hashes passed with the payload do not exactly match transaction versioned
/// hashes
/// - the block does not contain blob transactions if it is pre-cancun
///
/// This validates the following engine API rule:

View File

@ -210,6 +210,7 @@ pub enum BlockStatus {
/// This is required to:
/// - differentiate whether trie state updates should be cached.
/// - inform other
///
/// This is required because the state root check can only be performed if the targeted block can be
/// traced back to the canonical __head__.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]

View File

@ -257,6 +257,7 @@ impl<D> From<PathBuf> for MaybePlatformPath<D> {
/// * mainnet: `<DIR>/mainnet`
/// * goerli: `<DIR>/goerli`
/// * sepolia: `<DIR>/sepolia`
///
/// Otherwise, the path will be dependent on the chain ID:
/// * `<DIR>/<CHAIN_ID>`
#[derive(Clone, Debug, PartialEq, Eq)]

View File

@ -84,8 +84,8 @@ impl ExecutionPayloadValidator {
/// - invalid extra data
/// - invalid transactions
/// - incorrect hash
/// - the versioned hashes passed with the payload do not exactly match transaction
/// versioned hashes
/// - the versioned hashes passed with the payload do not exactly match transaction versioned
/// hashes
/// - the block does not contain blob transactions if it is pre-cancun
///
/// The checks are done in the order that conforms with the engine-API specification.

View File

@ -138,8 +138,8 @@ pub fn tx_env_with_recovered(transaction: &TransactionSignedEcRecovered) -> TxEn
/// and therefore:
/// * the call must execute to completion
/// * the call does not count against the blocks gas limit
/// * the call does not follow the EIP-1559 burn semantics - no value should be transferred as
/// part of the call
/// * the call does not follow the EIP-1559 burn semantics - no value should be transferred as part
/// of the call
/// * if no code exists at `BEACON_ROOTS_ADDRESS`, the call must fail silently
pub fn fill_tx_env_with_beacon_root_contract_call(env: &mut Env, parent_beacon_block_root: B256) {
env.tx = TxEnv {

View File

@ -1346,7 +1346,7 @@ impl TransactionSigned {
};
if !input_data.is_empty() {
return Err(RlpError::UnexpectedLength);
return Err(RlpError::UnexpectedLength)
}
Ok(output_data)

View File

@ -59,8 +59,7 @@ use tracing::*;
/// - [tables::BlockBodyIndices] get tx index to know what needs to be unwinded
/// - [tables::AccountsHistory] to remove change set and apply old values to
/// - [tables::PlainAccountState] [tables::StoragesHistory] to remove change set and apply old
/// values
/// to [tables::PlainStorageState]
/// values to [tables::PlainStorageState]
// false positive, we cannot derive it if !DB: Debug.
#[allow(missing_debug_implementations)]
pub struct ExecutionStage<E> {

View File

@ -70,11 +70,10 @@ impl Default for AccountHashingStage {
///
/// In order to check the "full hashing" mode of the stage you want to generate more
/// transitions than `AccountHashingStage.clean_threshold`. This requires:
/// 1. Creating enough blocks so there's enough transactions to generate
/// the required transition keys in the `BlockTransitionIndex` (which depends on the
/// `TxTransitionIndex` internally)
/// 2. Setting `blocks.len() > clean_threshold` so that there's enough diffs to actually
/// take the 2nd codepath
/// 1. Creating enough blocks so there's enough transactions to generate the required transition
/// keys in the `BlockTransitionIndex` (which depends on the `TxTransitionIndex` internally)
/// 2. Setting `blocks.len() > clean_threshold` so that there's enough diffs to actually take the
/// 2nd codepath
#[derive(Clone, Debug)]
pub struct SeedOpts {
/// The range of blocks to be generated

View File

@ -508,7 +508,6 @@ mod tests {
///
/// 1. If there are any entries in the [tables::TransactionSenders] table above a given
/// block number.
///
/// 2. If the is no requested block entry in the bodies table, but
/// [tables::TransactionSenders] is not empty.
fn ensure_no_senders_by_block(&self, block: BlockNumber) -> Result<(), TestRunnerError> {

View File

@ -429,7 +429,6 @@ mod tests {
///
/// 1. If there are any entries in the [tables::TransactionHashNumbers] table above a given
/// block number.
///
/// 2. If the is no requested block entry in the bodies table, but
/// [tables::TransactionHashNumbers] is not empty.
fn ensure_no_hash_by_block(&self, number: BlockNumber) -> Result<(), TestRunnerError> {

View File

@ -191,8 +191,7 @@ impl<K: TransactionKind, T: DupSort> DbDupCursorRO<T> for Cursor<K, T> {
/// - Some(key), Some(subkey): a `key` item whose data is >= than `subkey`
/// - Some(key), None: first item of a specified `key`
/// - None, Some(subkey): like first case, but in the first key
/// - None, None: first item in the table
/// of a DUPSORT table.
/// - None, None: first item in the table of a DUPSORT table.
fn walk_dup(
&mut self,
key: Option<T::Key>,

View File

@ -375,11 +375,11 @@ impl<TX: DbTxMut + DbTx> DatabaseProvider<TX> {
///
/// If UNWIND is false we will just read the state/blocks and return them.
///
/// 1. Iterate over the [BlockBodyIndices][tables::BlockBodyIndices] table to get all
/// the transaction ids.
/// 2. Iterate over the [StorageChangeSets][tables::StorageChangeSets] table
/// and the [AccountChangeSets][tables::AccountChangeSets] tables in reverse order to
/// reconstruct the changesets.
/// 1. Iterate over the [BlockBodyIndices][tables::BlockBodyIndices] table to get all the
/// transaction ids.
/// 2. Iterate over the [StorageChangeSets][tables::StorageChangeSets] table and the
/// [AccountChangeSets][tables::AccountChangeSets] tables in reverse order to reconstruct
/// the changesets.
/// - In order to have both the old and new values in the changesets, we also access the
/// plain state tables.
/// 3. While iterating over the changeset tables, if we encounter a new account or storage slot,

View File

@ -36,7 +36,7 @@ where
Poll::Ready(Some(Ok(item))) => return Poll::Ready(Some(item)),
Poll::Ready(Some(Err(e))) => {
warn!("BroadcastStream lagged: {e:?}");
continue;
continue
}
Poll::Ready(None) => return Poll::Ready(None),
Poll::Pending => return Poll::Pending,

View File

@ -34,16 +34,16 @@
//!
//! In essence the transaction pool is made of three separate sub-pools:
//!
//! - Pending Pool: Contains all transactions that are valid on the current state and satisfy
//! (3. a)(1): _No_ nonce gaps. A _pending_ transaction is considered _ready_ when it has the lowest
//! - Pending Pool: Contains all transactions that are valid on the current state and satisfy (3.
//! a)(1): _No_ nonce gaps. A _pending_ transaction is considered _ready_ when it has the lowest
//! nonce of all transactions from the same sender. Once a _ready_ transaction with nonce `n` has
//! been executed, the next highest transaction from the same sender `n + 1` becomes ready.
//!
//! - Queued Pool: Contains all transactions that are currently blocked by missing
//! transactions: (3. a)(2): _With_ nonce gaps or due to lack of funds.
//! - Queued Pool: Contains all transactions that are currently blocked by missing transactions:
//! (3. a)(2): _With_ nonce gaps or due to lack of funds.
//!
//! - Basefee Pool: To account for the dynamic base fee requirement (3. b) which could render
//! an EIP-1559 and all subsequent transactions of the sender currently invalid.
//! - Basefee Pool: To account for the dynamic base fee requirement (3. b) which could render an
//! EIP-1559 and all subsequent transactions of the sender currently invalid.
//!
//! The classification of transactions is always dependent on the current state that is changed as
//! soon as a new block is mined. Once a new block is mined, the account changeset must be applied

View File

@ -1002,6 +1002,7 @@ impl<T: PoolTransaction> AllTransactions<T> {
/// For all transactions:
/// - decreased basefee: promotes from `basefee` to `pending` sub-pool.
/// - increased basefee: demotes from `pending` to `basefee` sub-pool.
///
/// Individually:
/// - decreased sender allowance: demote from (`basefee`|`pending`) to `queued`.
/// - increased sender allowance: promote from `queued` to

View File

@ -8,12 +8,8 @@
//! ```
//!
//! This launch the regular reth node and also print:
//!
//! > "All components initialized"
//! once all components have been initialized and
//!
//! > "Node started"
//! once the node has been started.
//! > "All components initialized" once all components have been initialized
//! > "Node started" once the node has been started.
use reth::cli::Cli;
use reth_node_ethereum::EthereumNode;