From 6c5c4e857f99d21b1451f1882ac8e6c312990816 Mon Sep 17 00:00:00 2001 From: valvecitydev Date: Wed, 11 Nov 2026 19:10:05 -0600 Subject: [PATCH] chore(firehose): clear workspace clippy and doc lints No behavior change. This applies the workspace lints that reth-firehose and reth-firehose-tests opt into: const fn where clippy asks for it, Self:: in impls, backticks in docs, bool::then, next_back, &Path instead of &PathBuf. One test doc comment still named the StreamingFast alloy-evm fork, which no longer exists, so it now names evm2's system-call inspection. It also applies cargo +nightly fmt to the BAL Firehose tests in reth-engine-tree. --- .../tree/payload_processor/bal/firehose.rs | 4 ++- crates/firehose-tests/src/prestate.rs | 2 +- crates/firehose-tests/tests/prestate.rs | 12 ++++---- crates/firehose/src/lib.rs | 2 +- crates/firehose/src/mapper.rs | 29 +++++++++---------- crates/firehose/src/prelude.rs | 7 +++-- 6 files changed, 28 insertions(+), 28 deletions(-) diff --git a/crates/engine/tree/src/tree/payload_processor/bal/firehose.rs b/crates/engine/tree/src/tree/payload_processor/bal/firehose.rs index a9ed9eba142..df99f06cc04 100644 --- a/crates/engine/tree/src/tree/payload_processor/bal/firehose.rs +++ b/crates/engine/tree/src/tree/payload_processor/bal/firehose.rs @@ -554,7 +554,9 @@ mod tests { Address::from_raw_public_key(&coinbase_key.public_key().serialize_uncompressed()[1..]); let mut senders = keys .iter() - .map(|key| Address::from_raw_public_key(&key.public_key().serialize_uncompressed()[1..])) + .map(|key| { + Address::from_raw_public_key(&key.public_key().serialize_uncompressed()[1..]) + }) .collect::>(); senders.push(coinbase); diff --git a/crates/firehose-tests/src/prestate.rs b/crates/firehose-tests/src/prestate.rs index 5277b38cac6..a86e98c7b1b 100644 --- a/crates/firehose-tests/src/prestate.rs +++ b/crates/firehose-tests/src/prestate.rs @@ -334,7 +334,7 @@ pub fn parse_fire_block_for(raw: &[u8], block_number: u64) -> eyre::Result PathBuf { PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("tests").join("cases").join(name) } -fn golden_dir(case_dir: &PathBuf, name: &str) -> PathBuf { +fn golden_dir(case_dir: &Path, name: &str) -> PathBuf { case_dir.join(name) } diff --git a/crates/firehose/src/lib.rs b/crates/firehose/src/lib.rs index ab307c46b40..c9fdfb07914 100644 --- a/crates/firehose/src/lib.rs +++ b/crates/firehose/src/lib.rs @@ -74,7 +74,7 @@ pub struct SynchronizedStdout { impl SynchronizedStdout { /// Creates a new `SynchronizedStdout` backed by the given lock. - pub fn new(lock: Arc>) -> Self { + pub const fn new(lock: Arc>) -> Self { Self { lock } } } diff --git a/crates/firehose/src/mapper.rs b/crates/firehose/src/mapper.rs index 96915ad1381..bdd5c8e5c36 100644 --- a/crates/firehose/src/mapper.rs +++ b/crates/firehose/src/mapper.rs @@ -26,7 +26,7 @@ pub(crate) fn to_genesis_alloc(genesis: &Genesis) -> GenesisAlloc { *address, firehose_tracer::types::GenesisAccount { code: account.code.clone(), - balance: Some(account.balance.clone()), + balance: Some(account.balance), nonce: account.nonce.unwrap_or_default(), storage: map_genesis_storage(&account.storage), }, @@ -128,7 +128,7 @@ where /// finalized block's number/hash, if known. /// /// Callers on the live engine path read this from the in-memory canonical state (updated by -/// forkchoiceUpdated); a `None` num_hash means no finalized head is known yet. +/// forkchoiceUpdated); a `None` `num_hash` means no finalized head is known yet. pub fn finalized_ref_from_num_hash( num_hash: Option, ) -> Option { @@ -164,7 +164,7 @@ where } } -/// SignatureFields provides generic access to transaction signature (r, s, v) bytes. +/// `SignatureFields` provides generic access to transaction signature (r, s, v) bytes. /// /// This trait is needed because reth's `SignedTransaction` does not expose a generic /// `signature()` method — only concrete types like `EthereumTxEnvelope` have it. @@ -184,7 +184,7 @@ where let v = match self { // Legacy without EIP-155: V = 27 or 28 // Legacy with EIP-155: V = chain_id * 2 + 35 + y_parity - EthereumTxEnvelope::Legacy(signed) => { + Self::Legacy(signed) => { if let Some(chain_id) = signed.tx().chain_id { chain_id * 2 + 35 + y_parity } else { @@ -202,14 +202,15 @@ where } } -/// Encodes a u64 as big-endian bytes with no leading zeros (matching go-ethereum big.Int.Bytes()). +/// Encodes a u64 as big-endian bytes with no leading zeros (matching go-ethereum +/// `big.Int.Bytes()`). pub fn u64_to_trimmed_bytes(v: u64) -> Bytes { let bytes = v.to_be_bytes(); let start = bytes.iter().position(|&b| b != 0).unwrap_or(8); Bytes::copy_from_slice(&bytes[start..]) } -/// Converts a signed transaction to a firehose TxEvent. +/// Converts a signed transaction to a firehose `TxEvent`. pub fn signed_tx_to_tx_event( tx: &Tx, signer: Address, @@ -238,11 +239,7 @@ where r, s, v: Some(v), - max_fee_per_gas: if tx.is_dynamic_fee() { - Some(U256::from(tx.max_fee_per_gas())) - } else { - None - }, + max_fee_per_gas: tx.is_dynamic_fee().then(|| U256::from(tx.max_fee_per_gas())), max_priority_fee_per_gas: tx.max_priority_fee_per_gas().map(U256::from), access_list: tx .access_list() @@ -265,10 +262,10 @@ where } } -/// Wraps a StateProviderBox to implement the firehose StateReader trait. +/// Wraps a `StateProviderBox` to implement the firehose `StateReader` trait. /// -/// StateProviderBox is Box, so StateReaderAdapter -/// is automatically Send + 'static, satisfying the Box bound. +/// `StateProviderBox` is Box, so `StateReaderAdapter` +/// is automatically Send + 'static, satisfying the Box bound. pub struct StateReaderAdapter(pub StateProviderBox); impl Debug for StateReaderAdapter { @@ -326,10 +323,10 @@ pub fn receipt_data_from_parts( receipt_data } -/// Converts a receipt to a firehose ReceiptData. +/// Converts a receipt to a firehose `ReceiptData`. /// /// - `tx_index`: 0-based index of this transaction in the block -/// - `gas_used`: gas consumed by this transaction alone (cumulative_gas - prev_cumulative_gas) +/// - `gas_used`: gas consumed by this transaction alone (`cumulative_gas` - `prev_cumulative_gas`) /// - `log_index_start`: block-wide log index of the first log in this receipt /// - `blob_gas_used`: total blob gas consumed by this tx (0 for non-EIP-4844 transactions) /// - `blob_gas_price`: per-unit blob gas price from the block (None pre-Cancun) diff --git a/crates/firehose/src/prelude.rs b/crates/firehose/src/prelude.rs index 5172e1cf09d..05c890b6d8e 100644 --- a/crates/firehose/src/prelude.rs +++ b/crates/firehose/src/prelude.rs @@ -14,16 +14,17 @@ pub use alloy_primitives::{B256, U256}; // Other common imports pub use eyre; -/// Type alias for RecoveredBlock that can be used with any Node that implements FullNodeComponents +/// Type alias for `RecoveredBlock` that can be used with any Node that implements +/// `FullNodeComponents` pub type RecoveredBlock = reth_primitives_traits::RecoveredBlock< <<::Types as reth_node_api::NodeTypes>::Primitives as reth_node_api::NodePrimitives>::Block, >; -/// Type alias for ChainSpec that can be used with any Node that implements FullNodeComponents +/// Type alias for `ChainSpec` that can be used with any Node that implements `FullNodeComponents` pub type ChainSpec = <::Types as reth_node_api::NodeTypes>::ChainSpec; -/// Type alias for SignedTx from a Node primitives +/// Type alias for `SignedTx` from a Node primitives pub type SignedTx = <<::Types as reth_node_api::NodeTypes>::Primitives as reth_node_api::NodePrimitives>::SignedTx;