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/// Merkle Patricia trie range-proof verification.
67pub mod range_proof;
68
69/// The implementation of a container for storing intermediate changes to a trie.
70/// The container indicates when the trie has been modified.
71pub mod prefix_set;
72
73mod proofs;
74#[cfg(any(test, feature = "test-utils"))]
75pub use proofs::triehash;
76pub use proofs::*;
77
78pub mod root;
79
80/// Incremental ordered trie root computation.
81pub mod ordered_root;
82
83/// Buffer for trie updates.
84pub mod updates;
85
86/// Utilities used by other modules in this crate.
87mod utils;
88
89/// Bincode-compatible serde implementations for trie types.
90///
91/// `bincode` crate allows for more efficient serialization of trie types, because it allows
92/// non-string map keys.
93///
94/// Read more: <https://github.com/paradigmxyz/reth/issues/11370>
95#[cfg(all(feature = "serde", feature = "serde-bincode-compat"))]
96pub mod serde_bincode_compat {
97    pub use super::{
98        hashed_state::serde_bincode_compat as hashed_state,
99        updates::serde_bincode_compat as updates,
100    };
101}
102
103/// Re-export
104pub use alloy_trie::{
105    nodes::*, proof, BranchNodeCompact, HashBuilder, TrieMask, TrieMaskIter, EMPTY_ROOT_HASH,
106};