Skip to content

Commit

Permalink
add trace msgs
Browse files Browse the repository at this point in the history
  • Loading branch information
fgimenez committed Jan 23, 2025
1 parent 8c2518f commit 161bd66
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions crates/engine/tree/src/tree/root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,11 @@ where
let mut last_update_time = None;

loop {
trace!(target: "engine::root", "entering main channel receiving loop");
match self.rx.recv() {
Ok(message) => match message {
StateRootMessage::PrefetchProofs(targets) => {
trace!(target: "engine::root", "processing StateRootMessage::PrefetchProofs");
debug!(
target: "engine::root",
len = targets.len(),
Expand All @@ -521,6 +523,7 @@ where
);
}
StateRootMessage::StateUpdate(update) => {
trace!(target: "engine::root", "processing StateRootMessage::StateUpdate");
if updates_received == 0 {
first_update_time = Some(Instant::now());
debug!(target: "engine::root", "Started state root calculation");
Expand All @@ -544,10 +547,11 @@ where
);
}
StateRootMessage::FinishedStateUpdates => {
trace!(target: "engine::root", "Finished state updates");
trace!(target: "engine::root", "processing StateRootMessage::FinishedStateUpdates");
updates_finished = true;
}
StateRootMessage::ProofCalculated(proof_calculated) => {
trace!(target: "engine::root", "processing StateRootMessage::ProofCalculated");
proofs_processed += 1;
debug!(
target: "engine::root",
Expand All @@ -574,6 +578,7 @@ where
}
}
StateRootMessage::RootCalculated { state_root, trie_updates, iterations } => {
trace!(target: "engine::root", "processing StateRootMessage::RootCalculated");
let total_time =
first_update_time.expect("first update time should be set").elapsed();
let time_from_last_update =
Expand Down Expand Up @@ -669,7 +674,7 @@ where
let elapsed = update_sparse_trie(&mut trie, update).map_err(|e| {
ParallelStateRootError::Other(format!("could not calculate state root: {e:?}"))
})?;
trace!(target: "engine::root", ?elapsed, "Root calculation completed");
trace!(target: "engine::root", ?elapsed, num_iterations, "Root calculation completed");
}

debug!(target: "engine::root", num_iterations, "All proofs processed, ending calculation");
Expand Down

0 comments on commit 161bd66

Please sign in to comment.