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 trie_data;
19pub use trie_data::{ComputedTrieData, 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::{
42    ChunkedMultiProofTargetsV2, MultiProofTargetsV2, ProofV2Target, ProofV2TargetParent,
43};
44
45mod key;
46pub use key::{KeccakKeyHasher, KeyHasher};
47
48mod nibbles;
49pub use nibbles::{
50    depth_first_cmp, Nibbles, PackedStoredNibbles, PackedStoredNibblesSubKey, StoredNibbles,
51    StoredNibblesSubKey,
52};
53
54mod storage;
55pub use storage::{PackedStorageTrieEntry, StorageTrieEntry};
56
57mod subnode;
58pub use subnode::StoredSubNode;
59
60mod trie;
61pub use trie::{BranchNodeMasks, BranchNodeMasksMap, ProofTrieNode};
62
63mod trie_node_v2;
64pub use trie_node_v2::*;
65
66/// The implementation of a container for storing intermediate changes to a trie.
67/// The container indicates when the trie has been modified.
68pub mod prefix_set;
69
70mod proofs;
71#[cfg(any(test, feature = "test-utils"))]
72pub use proofs::triehash;
73pub use proofs::*;
74
75pub mod root;
76
77/// Incremental ordered trie root computation.
78pub mod ordered_root;
79
80/// Buffer for trie updates.
81pub mod updates;
82
83pub mod added_removed_keys;
84
85/// Utilities used by other modules in this crate.
86mod utils;
87
88/// Bincode-compatible serde implementations for trie types.
89///
90/// `bincode` crate allows for more efficient serialization of trie types, because it allows
91/// non-string map keys.
92///
93/// Read more: <https://github.com/paradigmxyz/reth/issues/11370>
94#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))]
95pub mod serde_bincode_compat {
96    pub use super::{
97        hashed_state::serde_bincode_compat as hashed_state,
98        updates::serde_bincode_compat as updates,
99    };
100}
101
102/// Re-export
103pub use alloy_trie::{
104    nodes::*, proof, BranchNodeCompact, HashBuilder, TrieMask, TrieMaskIter, EMPTY_ROOT_HASH,
105};