diff --git a/crates/trie/parallel/src/proof.rs b/crates/trie/parallel/src/proof.rs index cafb74fdc..2dadd22f2 100644 --- a/crates/trie/parallel/src/proof.rs +++ b/crates/trie/parallel/src/proof.rs @@ -27,10 +27,10 @@ use reth_trie_db::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory}; use std::{sync::Arc, time::Instant}; use tracing::{debug, trace}; -#[cfg(feature = "metrics")] -use crate::metrics::ParallelStateRootMetrics; - -/// TODO: +/// Parallel proof calculator. +/// +/// This can collect proof for many targets in parallel, spawning a task for each hashed address +/// that has proof targets. #[derive(Debug)] pub struct ParallelProof { /// Consistent view of the database. @@ -48,14 +48,11 @@ pub struct ParallelProof { collect_branch_node_masks: bool, /// Thread pool for local tasks thread_pool: Arc, - /// Parallel state root metrics. - #[cfg(feature = "metrics")] - metrics: ParallelStateRootMetrics, } impl ParallelProof { /// Create new state proof generator. - pub fn new( + pub const fn new( view: ConsistentDbView, nodes_sorted: Arc, state_sorted: Arc, @@ -69,8 +66,6 @@ impl ParallelProof { prefix_sets, collect_branch_node_masks: false, thread_pool, - #[cfg(feature = "metrics")] - metrics: ParallelStateRootMetrics::default(), } } @@ -119,7 +114,7 @@ where let storage_root_targets_len = storage_root_targets.len(); debug!( - target: "trie::parallel_state_root", + target: "trie::parallel_proof", total_targets = storage_root_targets_len, "Starting parallel proof generation" ); @@ -143,7 +138,7 @@ where self.thread_pool.spawn_fifo(move || { debug!( - target: "trie::parallel", + target: "trie::parallel_proof", ?hashed_address, "Starting proof calculation" ); @@ -153,7 +148,7 @@ where let provider_start = Instant::now(); let provider_ro = view.provider_ro()?; trace!( - target: "trie::parallel", + target: "trie::parallel_proof", ?hashed_address, provider_time = ?provider_start.elapsed(), "Got provider" @@ -169,7 +164,7 @@ where &hashed_state_sorted, ); trace!( - target: "trie::parallel", + target: "trie::parallel_proof", ?hashed_address, cursor_time = ?cursor_start.elapsed(), "Created cursors" @@ -188,7 +183,7 @@ where .map_err(|e| ParallelStateRootError::Other(e.to_string())); trace!( - target: "trie::parallel", + target: "trie::parallel_proof", ?hashed_address, prefix_set = ?prefix_set.len(), target_slots = ?target_slots_len, @@ -204,7 +199,7 @@ where // `account_node_iter` below. if let Err(e) = tx.send(result) { debug!( - target: "trie::parallel", + target: "trie::parallel_proof", ?hashed_address, error = ?e, task_time = ?task_start.elapsed(), @@ -300,9 +295,6 @@ where } let _ = hash_builder.root(); - #[cfg(feature = "metrics")] - self.metrics.record_state_trie(tracker.finish()); - let account_subtree = hash_builder.take_proof_nodes(); let (branch_node_hash_masks, branch_node_tree_masks) = if self.collect_branch_node_masks { let updated_branch_nodes = hash_builder.updated_branch_nodes.unwrap_or_default();