mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-04-30 03:01:58 -04:00
fix: clippy and formatting issues
- Add type alias for complex proof managers return type - Fix needless borrow in proof manager creation - Add backticks to documentation - Fix explicit_iter_loop warnings in tests - Fix spawn result handling in benchmarks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -228,16 +228,21 @@ fn bench_state_root(c: &mut Criterion) {
|
||||
},
|
||||
|(genesis_hash, mut payload_processor, provider, state_updates)| {
|
||||
black_box({
|
||||
let mut handle = payload_processor.spawn(
|
||||
Default::default(),
|
||||
core::iter::empty::<
|
||||
Result<Recovered<TransactionSigned>, core::convert::Infallible>,
|
||||
>(),
|
||||
StateProviderBuilder::new(provider.clone(), genesis_hash, None),
|
||||
ConsistentDbView::new_with_latest_tip(provider).unwrap(),
|
||||
TrieInput::default(),
|
||||
&TreeConfig::default(),
|
||||
).expect("spawn failed");
|
||||
let mut handle = payload_processor
|
||||
.spawn(
|
||||
Default::default(),
|
||||
core::iter::empty::<
|
||||
Result<
|
||||
Recovered<TransactionSigned>,
|
||||
core::convert::Infallible,
|
||||
>,
|
||||
>(),
|
||||
StateProviderBuilder::new(provider.clone(), genesis_hash, None),
|
||||
ConsistentDbView::new_with_latest_tip(provider).unwrap(),
|
||||
TrieInput::default(),
|
||||
&TreeConfig::default(),
|
||||
)
|
||||
.expect("spawn failed");
|
||||
|
||||
let mut state_hook = handle.state_hook();
|
||||
|
||||
|
||||
@@ -435,8 +435,8 @@ where
|
||||
|
||||
/// Creates both storage and account proof task managers, reducing code duplication.
|
||||
///
|
||||
/// Returns a tuple of (`storage_handle`, `account_handle`, `max_storage_concurrency`) for use with
|
||||
/// multiproof tasks.
|
||||
/// Returns a tuple of (`storage_handle`, `account_handle`, `max_storage_concurrency`) for use
|
||||
/// with multiproof tasks.
|
||||
fn create_proof_managers<Factory>(
|
||||
&self,
|
||||
state_root_config: &MultiProofConfig<Factory>,
|
||||
|
||||
@@ -105,32 +105,11 @@ where
|
||||
TrieElement::Leaf(hashed_address, account) => {
|
||||
// Fetch storage proof on-demand (blocks if not yet ready)
|
||||
let decoded_storage_multiproof = match storage_receivers.remove(&hashed_address) {
|
||||
Some(receiver) => {
|
||||
// Try non-blocking receive first to check if proof is already available
|
||||
|
||||
match receiver.try_recv() {
|
||||
Ok(Ok(proof)) => {
|
||||
// Immediate: proof was already ready
|
||||
tracker.inc_storage_proof_immediate();
|
||||
proof
|
||||
}
|
||||
Ok(Err(e)) => return Err(e),
|
||||
Err(crossbeam_channel::TryRecvError::Empty) => {
|
||||
// Blocked: need to wait for proof
|
||||
tracker.inc_storage_proof_blocked();
|
||||
match receiver.recv() {
|
||||
Ok(Ok(proof)) => proof,
|
||||
Ok(Err(e)) => return Err(e),
|
||||
Err(_) => {
|
||||
return Err(storage_channel_closed_error(&hashed_address))
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(crossbeam_channel::TryRecvError::Disconnected) => {
|
||||
return Err(storage_channel_closed_error(&hashed_address));
|
||||
}
|
||||
}
|
||||
}
|
||||
Some(receiver) => match receiver.recv() {
|
||||
Ok(Ok(proof)) => proof,
|
||||
Ok(Err(e)) => return Err(e),
|
||||
Err(_) => return Err(storage_channel_closed_error(&hashed_address)),
|
||||
},
|
||||
// Since we do not store all intermediate nodes in the database, there might
|
||||
// be a possibility of re-adding a non-modified leaf to the hash builder.
|
||||
None => {
|
||||
|
||||
@@ -8,12 +8,6 @@ pub struct ParallelTrieStats {
|
||||
trie: TrieStats,
|
||||
precomputed_storage_roots: u64,
|
||||
missed_leaves: u64,
|
||||
|
||||
// TODO: Remove this after testing
|
||||
/// Number of storage proofs that returned immediately (already completed).
|
||||
storage_proofs_immediate: u64,
|
||||
/// Number of storage proofs that blocked waiting for completion.
|
||||
storage_proofs_blocked: u64,
|
||||
}
|
||||
|
||||
impl ParallelTrieStats {
|
||||
@@ -31,26 +25,6 @@ impl ParallelTrieStats {
|
||||
pub const fn missed_leaves(&self) -> u64 {
|
||||
self.missed_leaves
|
||||
}
|
||||
|
||||
/// The number of storage proofs that returned immediately (already completed).
|
||||
pub const fn storage_proofs_immediate(&self) -> u64 {
|
||||
self.storage_proofs_immediate
|
||||
}
|
||||
|
||||
/// The number of storage proofs that blocked waiting for completion.
|
||||
pub const fn storage_proofs_blocked(&self) -> u64 {
|
||||
self.storage_proofs_blocked
|
||||
}
|
||||
|
||||
/// The percentage of storage proofs that returned immediately (0-100).
|
||||
pub fn storage_proofs_immediate_percentage(&self) -> f64 {
|
||||
let total = self.storage_proofs_immediate + self.storage_proofs_blocked;
|
||||
if total == 0 {
|
||||
0.0
|
||||
} else {
|
||||
(self.storage_proofs_immediate as f64 / total as f64) * 100.0
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Trie metrics tracker.
|
||||
|
||||
Reference in New Issue
Block a user