Skip to main content

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
14mod execution_witness;
15pub use execution_witness::ExecutionWitnessMode;
16
17/// Lazy initialization wrapper for trie data.
18mod lazy;
19pub use lazy::{LazyTrieData, SortedTrieData};
20
21/// In-memory hashed state.
22mod hashed_state;
23pub use hashed_state::*;
24
25/// Input for trie computation.
26mod input;
27pub use input::{TrieInput, TrieInputSorted};
28
29/// The implementation of hash builder.
30pub mod hash_builder;
31
32/// Constants related to the trie computation.
33mod constants;
34pub use constants::*;
35
36mod account;
37pub use account::TrieAccount;
38
39/// V2 proof targets and chunking.
40pub mod target_v2;
41pub use target_v2::{ChunkedMultiProofTargetsV2, MultiProofTargetsV2, ProofV2Target};
42
43mod key;
44pub use key::{KeccakKeyHasher, KeyHasher};
45
46mod nibbles;
47pub use nibbles::{
48    depth_first_cmp, Nibbles, PackedStoredNibbles, PackedStoredNibblesSubKey, StoredNibbles,
49    StoredNibblesSubKey,
50};
51
52mod storage;
53pub use storage::{PackedStorageTrieEntry, StorageTrieEntry};
54
55mod subnode;
56pub use subnode::StoredSubNode;
57
58mod trie;
59pub use trie::{BranchNodeMasks, BranchNodeMasksMap, ProofTrieNode};
60
61mod trie_node_v2;
62pub use trie_node_v2::*;
63
64/// The implementation of a container for storing intermediate changes to a trie.
65/// The container indicates when the trie has been modified.
66pub mod prefix_set;
67
68mod proofs;
69#[cfg(any(test, feature = "test-utils"))]
70pub use proofs::triehash;
71pub use proofs::*;
72
73pub mod root;
74
75/// Incremental ordered trie root computation.
76pub mod ordered_root;
77
78/// Buffer for trie updates.
79pub mod updates;
80
81pub mod added_removed_keys;
82
83/// Utilities used by other modules in this crate.
84mod utils;
85
86/// Bincode-compatible serde implementations for trie types.
87///
88/// `bincode` crate allows for more efficient serialization of trie types, because it allows
89/// non-string map keys.
90///
91/// Read more: <https://github.com/paradigmxyz/reth/issues/11370>
92#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))]
93pub mod serde_bincode_compat {
94    pub use super::{
95        hashed_state::serde_bincode_compat as hashed_state,
96        updates::serde_bincode_compat as updates,
97    };
98}
99
100/// Re-export
101pub use alloy_trie::{
102    nodes::*, proof, BranchNodeCompact, HashBuilder, TrieMask, TrieMaskIter, EMPTY_ROOT_HASH,
103};