chore(trie): Spans and traces for sparse trie (#21973)

This commit is contained in:
Brian Picciano
2026-02-09 12:53:40 +01:00
committed by GitHub
parent 655a463c18
commit 6aebf8c064
3 changed files with 49 additions and 0 deletions

View File

@@ -623,6 +623,7 @@ where
if new { &mut self.new_storage_updates } else { &mut self.storage_updates };
// Process all storage updates in parallel, skipping tries with no pending updates.
let span = tracing::Span::current();
let storage_results = storage_updates
.iter_mut()
.filter(|(_, updates)| !updates.is_empty())
@@ -634,6 +635,7 @@ where
})
.par_bridge_buffered()
.map(|(address, updates, mut fetched, mut trie)| {
let _enter = debug_span!(target: "engine::tree::payload_processor::sparse_trie", parent: &span, "storage trie leaf updates", ?address).entered();
let mut targets = Vec::new();
trie.update_leaves(updates, |path, min_len| match fetched.entry(path) {
@@ -653,6 +655,8 @@ where
})
.collect::<Result<Vec<_>, _>>()?;
drop(span);
for (address, targets, fetched, trie) in storage_results {
self.fetched_storage_targets.insert(*address, fetched);
self.trie.insert_storage_trie(*address, trie);
@@ -714,6 +718,7 @@ where
return Ok(());
}
let span = tracing::Span::current();
let roots = self
.trie
.storage_tries_mut()
@@ -722,6 +727,7 @@ where
self.storage_updates.get(*address).is_some_and(|updates| updates.is_empty())
})
.map(|(address, trie)| {
let _enter = debug_span!(target: "engine::tree::payload_processor::sparse_trie", parent: &span, "storage root", ?address).entered();
let root =
trie.root().expect("updates are drained, trie should be revealed by now");