mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore(trie): move prefix sets to reth_trie_common (#12860)
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -9381,6 +9381,7 @@ dependencies = [
|
|||||||
"alloy-trie",
|
"alloy-trie",
|
||||||
"arbitrary",
|
"arbitrary",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"criterion",
|
||||||
"derive_more 1.0.0",
|
"derive_more 1.0.0",
|
||||||
"hash-db",
|
"hash-db",
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
|
|||||||
@ -35,12 +35,14 @@ arbitrary = { workspace = true, features = ["derive"], optional = true }
|
|||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
alloy-primitives = { workspace = true, features = ["getrandom"] }
|
alloy-primitives = { workspace = true, features = ["getrandom"] }
|
||||||
arbitrary = { workspace = true, features = ["derive"] }
|
alloy-trie = { workspace = true, features = ["arbitrary"] }
|
||||||
proptest.workspace = true
|
|
||||||
proptest-arbitrary-interop.workspace = true
|
|
||||||
hash-db = "=0.15.2"
|
hash-db = "=0.15.2"
|
||||||
plain_hasher = "0.2"
|
plain_hasher = "0.2"
|
||||||
serde_json.workspace = true
|
serde_json.workspace = true
|
||||||
|
arbitrary = { workspace = true, features = ["derive"] }
|
||||||
|
proptest.workspace = true
|
||||||
|
proptest-arbitrary-interop.workspace = true
|
||||||
|
criterion.workspace = true
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
test-utils = [
|
test-utils = [
|
||||||
@ -60,3 +62,7 @@ arbitrary = [
|
|||||||
"revm-primitives/arbitrary",
|
"revm-primitives/arbitrary",
|
||||||
"reth-codecs/arbitrary",
|
"reth-codecs/arbitrary",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[bench]]
|
||||||
|
name = "prefix_set"
|
||||||
|
harness = false
|
||||||
|
|||||||
@ -7,7 +7,7 @@ use proptest::{
|
|||||||
strategy::ValueTree,
|
strategy::ValueTree,
|
||||||
test_runner::{basic_result_cache, TestRunner},
|
test_runner::{basic_result_cache, TestRunner},
|
||||||
};
|
};
|
||||||
use reth_trie::{
|
use reth_trie_common::{
|
||||||
prefix_set::{PrefixSet, PrefixSetMut},
|
prefix_set::{PrefixSet, PrefixSetMut},
|
||||||
Nibbles,
|
Nibbles,
|
||||||
};
|
};
|
||||||
@ -26,6 +26,10 @@ pub use storage::StorageTrieEntry;
|
|||||||
mod subnode;
|
mod subnode;
|
||||||
pub use subnode::StoredSubNode;
|
pub use subnode::StoredSubNode;
|
||||||
|
|
||||||
|
/// The implementation of a container for storing intermediate changes to a trie.
|
||||||
|
/// The container indicates when the trie has been modified.
|
||||||
|
pub mod prefix_set;
|
||||||
|
|
||||||
mod proofs;
|
mod proofs;
|
||||||
#[cfg(any(test, feature = "test-utils"))]
|
#[cfg(any(test, feature = "test-utils"))]
|
||||||
pub use proofs::triehash;
|
pub use proofs::triehash;
|
||||||
@ -33,4 +37,5 @@ pub use proofs::*;
|
|||||||
|
|
||||||
pub mod root;
|
pub mod root;
|
||||||
|
|
||||||
|
/// Re-export
|
||||||
pub use alloy_trie::{nodes::*, proof, BranchNodeCompact, HashBuilder, TrieMask, EMPTY_ROOT_HASH};
|
pub use alloy_trie::{nodes::*, proof, BranchNodeCompact, HashBuilder, TrieMask, EMPTY_ROOT_HASH};
|
||||||
|
|||||||
@ -73,7 +73,7 @@ pub struct TriePrefixSets {
|
|||||||
/// # Examples
|
/// # Examples
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// use reth_trie::{prefix_set::PrefixSetMut, Nibbles};
|
/// use reth_trie_common::{prefix_set::PrefixSetMut, Nibbles};
|
||||||
///
|
///
|
||||||
/// let mut prefix_set_mut = PrefixSetMut::default();
|
/// let mut prefix_set_mut = PrefixSetMut::default();
|
||||||
/// prefix_set_mut.insert(Nibbles::from_nibbles_unchecked(&[0xa, 0xb]));
|
/// prefix_set_mut.insert(Nibbles::from_nibbles_unchecked(&[0xa, 0xb]));
|
||||||
@ -211,8 +211,8 @@ impl PrefixSet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> IntoIterator for &'a PrefixSet {
|
impl<'a> IntoIterator for &'a PrefixSet {
|
||||||
type Item = &'a reth_trie_common::Nibbles;
|
type Item = &'a Nibbles;
|
||||||
type IntoIter = std::slice::Iter<'a, reth_trie_common::Nibbles>;
|
type IntoIter = std::slice::Iter<'a, Nibbles>;
|
||||||
fn into_iter(self) -> Self::IntoIter {
|
fn into_iter(self) -> Self::IntoIter {
|
||||||
self.iter()
|
self.iter()
|
||||||
}
|
}
|
||||||
@ -85,10 +85,6 @@ test-utils = [
|
|||||||
"reth-stages-types/test-utils"
|
"reth-stages-types/test-utils"
|
||||||
]
|
]
|
||||||
|
|
||||||
[[bench]]
|
|
||||||
name = "prefix_set"
|
|
||||||
harness = false
|
|
||||||
|
|
||||||
[[bench]]
|
[[bench]]
|
||||||
name = "hash_post_state"
|
name = "hash_post_state"
|
||||||
harness = false
|
harness = false
|
||||||
|
|||||||
@ -17,10 +17,6 @@
|
|||||||
mod constants;
|
mod constants;
|
||||||
pub use constants::*;
|
pub use constants::*;
|
||||||
|
|
||||||
/// The implementation of a container for storing intermediate changes to a trie.
|
|
||||||
/// The container indicates when the trie has been modified.
|
|
||||||
pub mod prefix_set;
|
|
||||||
|
|
||||||
/// The implementation of forward-only in-memory cursor.
|
/// The implementation of forward-only in-memory cursor.
|
||||||
pub mod forward_cursor;
|
pub mod forward_cursor;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user