reth_trie_common/
lib.rs

1//! Commonly used types for trie usage.
2
3#![doc(
4    html_logo_url = "https://raw.githubusercontent.com/paradigmxyz/reth/main/assets/reth-docs.png",
5    html_favicon_url = "https://avatars0.githubusercontent.com/u/97369466?s=256",
6    issue_tracker_base_url = "https://github.com/paradigmxyz/reth/issues/"
7)]
8#![cfg_attr(not(test), warn(unused_crate_dependencies))]
9#![cfg_attr(docsrs, feature(doc_cfg))]
10#![cfg_attr(not(feature = "std"), no_std)]
11
12extern crate alloc;
13
14/// Lazy initialization wrapper for trie data.
15mod lazy;
16pub use lazy::{LazyTrieData, SortedTrieData};
17
18/// In-memory hashed state.
19mod hashed_state;
20pub use hashed_state::*;
21
22/// Input for trie computation.
23mod input;
24pub use input::{TrieInput, TrieInputSorted};
25
26/// The implementation of hash builder.
27pub mod hash_builder;
28
29/// Constants related to the trie computation.
30mod constants;
31pub use constants::*;
32
33mod account;
34pub use account::TrieAccount;
35
36mod key;
37pub use key::{KeccakKeyHasher, KeyHasher};
38
39mod nibbles;
40pub use nibbles::{Nibbles, StoredNibbles, StoredNibblesSubKey};
41
42mod storage;
43pub use storage::StorageTrieEntry;
44
45mod subnode;
46pub use subnode::StoredSubNode;
47
48mod trie;
49pub use trie::{BranchNodeMasks, BranchNodeMasksMap, ProofTrieNode};
50
51/// The implementation of a container for storing intermediate changes to a trie.
52/// The container indicates when the trie has been modified.
53pub mod prefix_set;
54
55mod proofs;
56#[cfg(any(test, feature = "test-utils"))]
57pub use proofs::triehash;
58pub use proofs::*;
59
60pub mod root;
61
62/// Incremental ordered trie root computation.
63pub mod ordered_root;
64
65/// Buffer for trie updates.
66pub mod updates;
67
68pub mod added_removed_keys;
69
70/// Utilities used by other modules in this crate.
71mod utils;
72
73/// Bincode-compatible serde implementations for trie types.
74///
75/// `bincode` crate allows for more efficient serialization of trie types, because it allows
76/// non-string map keys.
77///
78/// Read more: <https://github.com/paradigmxyz/reth/issues/11370>
79#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))]
80pub mod serde_bincode_compat {
81    pub use super::{
82        hashed_state::serde_bincode_compat as hashed_state,
83        updates::serde_bincode_compat as updates,
84    };
85}
86
87/// Re-export
88pub use alloy_trie::{nodes::*, proof, BranchNodeCompact, HashBuilder, TrieMask, EMPTY_ROOT_HASH};