Skip to content

Commit

Permalink
fix: do not record trie root metrics for ParallelProof (paradigmxyz#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Jan 27, 2025
1 parent 2cdde50 commit 4e78566
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions crates/trie/parallel/src/proof.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Factory> {
/// Consistent view of the database.
Expand All @@ -48,14 +48,11 @@ pub struct ParallelProof<Factory> {
collect_branch_node_masks: bool,
/// Thread pool for local tasks
thread_pool: Arc<rayon::ThreadPool>,
/// Parallel state root metrics.
#[cfg(feature = "metrics")]
metrics: ParallelStateRootMetrics,
}

impl<Factory> ParallelProof<Factory> {
/// Create new state proof generator.
pub fn new(
pub const fn new(
view: ConsistentDbView<Factory>,
nodes_sorted: Arc<TrieUpdatesSorted>,
state_sorted: Arc<HashedPostStateSorted>,
Expand All @@ -69,8 +66,6 @@ impl<Factory> ParallelProof<Factory> {
prefix_sets,
collect_branch_node_masks: false,
thread_pool,
#[cfg(feature = "metrics")]
metrics: ParallelStateRootMetrics::default(),
}
}

Expand Down Expand Up @@ -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"
);
Expand All @@ -143,7 +138,7 @@ where

self.thread_pool.spawn_fifo(move || {
debug!(
target: "trie::parallel",
target: "trie::parallel_proof",
?hashed_address,
"Starting proof calculation"
);
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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,
Expand All @@ -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(),
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 4e78566

Please sign in to comment.