mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(trie): more logs for proofs (#13843)
This commit is contained in:
@ -175,6 +175,7 @@ where
|
|||||||
"Created cursors"
|
"Created cursors"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let target_slots_len = target_slots.len();
|
||||||
let proof_start = Instant::now();
|
let proof_start = Instant::now();
|
||||||
let proof_result = StorageProof::new_hashed(
|
let proof_result = StorageProof::new_hashed(
|
||||||
trie_cursor_factory,
|
trie_cursor_factory,
|
||||||
@ -189,6 +190,8 @@ where
|
|||||||
trace!(
|
trace!(
|
||||||
target: "trie::parallel",
|
target: "trie::parallel",
|
||||||
?hashed_address,
|
?hashed_address,
|
||||||
|
prefix_set = ?prefix_set.len(),
|
||||||
|
target_slots = ?target_slots_len,
|
||||||
proof_time = ?proof_start.elapsed(),
|
proof_time = ?proof_start.elapsed(),
|
||||||
"Completed proof calculation"
|
"Completed proof calculation"
|
||||||
);
|
);
|
||||||
|
|||||||
@ -9,8 +9,8 @@ use reth_trie_common::{prefix_set::TriePrefixSetsMut, Nibbles};
|
|||||||
use reth_trie_sparse::blinded::{
|
use reth_trie_sparse::blinded::{
|
||||||
pad_path_to_key, BlindedProvider, BlindedProviderFactory, RevealedNode,
|
pad_path_to_key, BlindedProvider, BlindedProviderFactory, RevealedNode,
|
||||||
};
|
};
|
||||||
use std::sync::Arc;
|
use std::{sync::Arc, time::Instant};
|
||||||
use tracing::trace;
|
use tracing::{enabled, trace, Level};
|
||||||
|
|
||||||
/// Factory for instantiating providers capable of retrieving blinded trie nodes via proofs.
|
/// Factory for instantiating providers capable of retrieving blinded trie nodes via proofs.
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@ -88,6 +88,8 @@ where
|
|||||||
H: HashedCursorFactory + Clone + Send + Sync,
|
H: HashedCursorFactory + Clone + Send + Sync,
|
||||||
{
|
{
|
||||||
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||||
|
let start = enabled!(target: "trie::proof::blinded", Level::TRACE).then(Instant::now);
|
||||||
|
|
||||||
let targets = HashMap::from_iter([(pad_path_to_key(path), HashSet::default())]);
|
let targets = HashMap::from_iter([(pad_path_to_key(path), HashSet::default())]);
|
||||||
let mut proof =
|
let mut proof =
|
||||||
Proof::new(self.trie_cursor_factory.clone(), self.hashed_cursor_factory.clone())
|
Proof::new(self.trie_cursor_factory.clone(), self.hashed_cursor_factory.clone())
|
||||||
@ -98,8 +100,16 @@ where
|
|||||||
let node = proof.account_subtree.into_inner().remove(path);
|
let node = proof.account_subtree.into_inner().remove(path);
|
||||||
let tree_mask = proof.branch_node_tree_masks.remove(path);
|
let tree_mask = proof.branch_node_tree_masks.remove(path);
|
||||||
let hash_mask = proof.branch_node_hash_masks.remove(path);
|
let hash_mask = proof.branch_node_hash_masks.remove(path);
|
||||||
trace!(target: "trie::proof::blinded", ?path, ?node, "Blinded node for account trie");
|
|
||||||
|
|
||||||
|
trace!(
|
||||||
|
target: "trie::proof::blinded",
|
||||||
|
elapsed = ?start.unwrap().elapsed(),
|
||||||
|
?path,
|
||||||
|
?node,
|
||||||
|
?tree_mask,
|
||||||
|
?hash_mask,
|
||||||
|
"Blinded node for account trie"
|
||||||
|
);
|
||||||
Ok(node.map(|node| RevealedNode { node, tree_mask, hash_mask }))
|
Ok(node.map(|node| RevealedNode { node, tree_mask, hash_mask }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -135,6 +145,8 @@ where
|
|||||||
H: HashedCursorFactory + Clone + Send + Sync,
|
H: HashedCursorFactory + Clone + Send + Sync,
|
||||||
{
|
{
|
||||||
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
fn blinded_node(&mut self, path: &Nibbles) -> Result<Option<RevealedNode>, SparseTrieError> {
|
||||||
|
let start = enabled!(target: "trie::proof::blinded", Level::TRACE).then(Instant::now);
|
||||||
|
|
||||||
let targets = HashSet::from_iter([pad_path_to_key(path)]);
|
let targets = HashSet::from_iter([pad_path_to_key(path)]);
|
||||||
let storage_prefix_set =
|
let storage_prefix_set =
|
||||||
self.prefix_sets.storage_prefix_sets.get(&self.account).cloned().unwrap_or_default();
|
self.prefix_sets.storage_prefix_sets.get(&self.account).cloned().unwrap_or_default();
|
||||||
@ -150,8 +162,17 @@ where
|
|||||||
let node = proof.subtree.into_inner().remove(path);
|
let node = proof.subtree.into_inner().remove(path);
|
||||||
let tree_mask = proof.branch_node_tree_masks.remove(path);
|
let tree_mask = proof.branch_node_tree_masks.remove(path);
|
||||||
let hash_mask = proof.branch_node_hash_masks.remove(path);
|
let hash_mask = proof.branch_node_hash_masks.remove(path);
|
||||||
trace!(target: "trie::proof::blinded", account = ?self.account, ?path, ?node, "Blinded node for storage trie");
|
|
||||||
|
|
||||||
|
trace!(
|
||||||
|
target: "trie::proof::blinded",
|
||||||
|
account = ?self.account,
|
||||||
|
elapsed = ?start.unwrap().elapsed(),
|
||||||
|
?path,
|
||||||
|
?node,
|
||||||
|
?tree_mask,
|
||||||
|
?hash_mask,
|
||||||
|
"Blinded node for storage trie"
|
||||||
|
);
|
||||||
Ok(node.map(|node| RevealedNode { node, tree_mask, hash_mask }))
|
Ok(node.map(|node| RevealedNode { node, tree_mask, hash_mask }))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user