mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(trie): exclude blinded providers from Debug impl (#13098)
This commit is contained in:
@ -3,6 +3,7 @@ use crate::{
|
||||
RevealedSparseTrie, SparseStateTrieError, SparseStateTrieResult, SparseTrie, SparseTrieError,
|
||||
};
|
||||
use alloy_primitives::{
|
||||
hex,
|
||||
map::{HashMap, HashSet},
|
||||
Bytes, B256,
|
||||
};
|
||||
@ -13,10 +14,9 @@ use reth_trie_common::{
|
||||
updates::{StorageTrieUpdates, TrieUpdates},
|
||||
MultiProof, Nibbles, TrieAccount, TrieNode, EMPTY_ROOT_HASH, TRIE_ACCOUNT_RLP_MAX_SIZE,
|
||||
};
|
||||
use std::iter::Peekable;
|
||||
use std::{fmt, iter::Peekable};
|
||||
|
||||
/// Sparse state trie representing lazy-loaded Ethereum state trie.
|
||||
#[derive(Debug)]
|
||||
pub struct SparseStateTrie<F: BlindedProviderFactory = DefaultBlindedProviderFactory> {
|
||||
/// Blinded node provider factory.
|
||||
provider_factory: F,
|
||||
@ -45,6 +45,18 @@ impl Default for SparseStateTrie {
|
||||
}
|
||||
}
|
||||
|
||||
impl fmt::Debug for SparseStateTrie {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
f.debug_struct("SparseStateTrie")
|
||||
.field("state", &self.state)
|
||||
.field("storages", &self.storages)
|
||||
.field("revealed", &self.revealed)
|
||||
.field("retain_updates", &self.retain_updates)
|
||||
.field("account_rlp_buf", &hex::encode(&self.account_rlp_buf))
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
impl SparseStateTrie {
|
||||
/// Create state trie from state trie.
|
||||
pub fn from_state(state: SparseTrie) -> Self {
|
||||
|
||||
@ -19,7 +19,7 @@ use std::{borrow::Cow, fmt};
|
||||
|
||||
/// Inner representation of the sparse trie.
|
||||
/// Sparse trie is blind by default until nodes are revealed.
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
#[derive(PartialEq, Eq)]
|
||||
pub enum SparseTrie<P = DefaultBlindedProvider> {
|
||||
/// None of the trie nodes are known.
|
||||
Blind,
|
||||
@ -27,6 +27,15 @@ pub enum SparseTrie<P = DefaultBlindedProvider> {
|
||||
Revealed(Box<RevealedSparseTrie<P>>),
|
||||
}
|
||||
|
||||
impl<P> fmt::Debug for SparseTrie<P> {
|
||||
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||
match self {
|
||||
Self::Blind => write!(f, "Blind"),
|
||||
Self::Revealed(revealed) => write!(f, "Revealed({revealed:?})"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<P> Default for SparseTrie<P> {
|
||||
fn default() -> Self {
|
||||
Self::Blind
|
||||
@ -164,7 +173,7 @@ impl<P> fmt::Debug for RevealedSparseTrie<P> {
|
||||
.field("prefix_set", &self.prefix_set)
|
||||
.field("updates", &self.updates)
|
||||
.field("rlp_buf", &hex::encode(&self.rlp_buf))
|
||||
.finish()
|
||||
.finish_non_exhaustive()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user