diff --git a/Cargo.lock b/Cargo.lock index 3a570283c..5b4ccbd7e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -8890,6 +8890,7 @@ dependencies = [ name = "reth-trie-db" version = "1.0.6" dependencies = [ + "alloy-primitives", "alloy-rlp", "auto_impl", "derive_more", @@ -8924,6 +8925,7 @@ dependencies = [ name = "reth-trie-parallel" version = "1.0.6" dependencies = [ + "alloy-primitives", "alloy-rlp", "criterion", "derive_more", diff --git a/crates/trie/db/Cargo.toml b/crates/trie/db/Cargo.toml index d05d35011..6d322ba3f 100644 --- a/crates/trie/db/Cargo.toml +++ b/crates/trie/db/Cargo.toml @@ -26,6 +26,7 @@ revm.workspace = true # alloy alloy-rlp.workspace = true +alloy-primitives.workspace = true # tracing tracing.workspace = true diff --git a/crates/trie/db/src/hashed_cursor.rs b/crates/trie/db/src/hashed_cursor.rs index 9f939fb98..bf0341c88 100644 --- a/crates/trie/db/src/hashed_cursor.rs +++ b/crates/trie/db/src/hashed_cursor.rs @@ -1,9 +1,10 @@ +use alloy_primitives::{B256, U256}; use reth_db::tables; use reth_db_api::{ cursor::{DbCursorRO, DbDupCursorRO}, transaction::DbTx, }; -use reth_primitives::{Account, B256, U256}; +use reth_primitives::Account; use reth_trie::hashed_cursor::{HashedCursor, HashedCursorFactory, HashedStorageCursor}; /// A struct wrapping database transaction that implements [`HashedCursorFactory`]. diff --git a/crates/trie/db/src/prefix_set.rs b/crates/trie/db/src/prefix_set.rs index f55a03ab3..07b87016d 100644 --- a/crates/trie/db/src/prefix_set.rs +++ b/crates/trie/db/src/prefix_set.rs @@ -1,3 +1,4 @@ +use alloy_primitives::{keccak256, BlockNumber, B256}; use derive_more::Deref; use reth_db::tables; use reth_db_api::{ @@ -6,7 +7,7 @@ use reth_db_api::{ transaction::DbTx, DatabaseError, }; -use reth_primitives::{keccak256, BlockNumber, StorageEntry, B256}; +use reth_primitives::StorageEntry; use reth_trie::prefix_set::{PrefixSetMut, TriePrefixSets}; use reth_trie_common::Nibbles; use std::{ diff --git a/crates/trie/db/src/proof.rs b/crates/trie/db/src/proof.rs index def14961a..2d06d9e2f 100644 --- a/crates/trie/db/src/proof.rs +++ b/crates/trie/db/src/proof.rs @@ -1,7 +1,7 @@ use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory}; +use alloy_primitives::{Address, B256}; use reth_db_api::transaction::DbTx; use reth_execution_errors::StateProofError; -use reth_primitives::{Address, B256}; use reth_trie::{ hashed_cursor::HashedPostStateCursorFactory, proof::Proof, trie_cursor::InMemoryTrieCursorFactory, MultiProof, TrieInput, diff --git a/crates/trie/db/src/state.rs b/crates/trie/db/src/state.rs index c883f3ad8..4f27679dd 100644 --- a/crates/trie/db/src/state.rs +++ b/crates/trie/db/src/state.rs @@ -1,4 +1,5 @@ use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory, PrefixSetLoader}; +use alloy_primitives::{keccak256, Address, BlockNumber, B256, U256}; use reth_db::tables; use reth_db_api::{ cursor::DbCursorRO, @@ -6,7 +7,7 @@ use reth_db_api::{ transaction::DbTx, }; use reth_execution_errors::StateRootError; -use reth_primitives::{keccak256, Account, Address, BlockNumber, B256, U256}; +use reth_primitives::Account; use reth_storage_errors::db::DatabaseError; use reth_trie::{ hashed_cursor::HashedPostStateCursorFactory, trie_cursor::InMemoryTrieCursorFactory, diff --git a/crates/trie/db/src/storage.rs b/crates/trie/db/src/storage.rs index 9ab2cdeda..6a3bbe1b9 100644 --- a/crates/trie/db/src/storage.rs +++ b/crates/trie/db/src/storage.rs @@ -1,10 +1,10 @@ use std::collections::hash_map; use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory}; +use alloy_primitives::{keccak256, Address, BlockNumber, B256}; use reth_db::{cursor::DbCursorRO, models::BlockNumberAddress, tables, DatabaseError}; use reth_db_api::transaction::DbTx; use reth_execution_errors::StorageRootError; -use reth_primitives::{keccak256, Address, BlockNumber, B256}; use reth_trie::{ hashed_cursor::HashedPostStateCursorFactory, HashedPostState, HashedStorage, StorageRoot, }; diff --git a/crates/trie/db/src/trie_cursor.rs b/crates/trie/db/src/trie_cursor.rs index 28a510dd4..124b8ccb2 100644 --- a/crates/trie/db/src/trie_cursor.rs +++ b/crates/trie/db/src/trie_cursor.rs @@ -1,3 +1,4 @@ +use alloy_primitives::B256; use reth_db::{ cursor::{DbCursorRW, DbDupCursorRW}, tables, @@ -6,7 +7,6 @@ use reth_db_api::{ cursor::{DbCursorRO, DbDupCursorRO}, transaction::DbTx, }; -use reth_primitives::B256; use reth_storage_errors::db::DatabaseError; use reth_trie::{ trie_cursor::{TrieCursor, TrieCursorFactory}, diff --git a/crates/trie/db/src/witness.rs b/crates/trie/db/src/witness.rs index de5687191..62b945d26 100644 --- a/crates/trie/db/src/witness.rs +++ b/crates/trie/db/src/witness.rs @@ -1,7 +1,7 @@ use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory}; +use alloy_primitives::{Bytes, B256}; use reth_db_api::transaction::DbTx; use reth_execution_errors::TrieWitnessError; -use reth_primitives::{Bytes, B256}; use reth_trie::{ hashed_cursor::HashedPostStateCursorFactory, trie_cursor::InMemoryTrieCursorFactory, witness::TrieWitness, HashedPostState, TrieInput, diff --git a/crates/trie/db/tests/fuzz_in_memory_nodes.rs b/crates/trie/db/tests/fuzz_in_memory_nodes.rs index 3637dc8ba..c0bea366b 100644 --- a/crates/trie/db/tests/fuzz_in_memory_nodes.rs +++ b/crates/trie/db/tests/fuzz_in_memory_nodes.rs @@ -1,10 +1,11 @@ +use alloy_primitives::{B256, U256}; use proptest::prelude::*; use reth_db::{ cursor::{DbCursorRO, DbCursorRW, DbDupCursorRW}, tables, transaction::DbTxMut, }; -use reth_primitives::{Account, StorageEntry, B256, U256}; +use reth_primitives::{Account, StorageEntry}; use reth_provider::test_utils::create_test_provider_factory; use reth_trie::{ test_utils::{state_root_prehashed, storage_root_prehashed}, diff --git a/crates/trie/db/tests/post_state.rs b/crates/trie/db/tests/post_state.rs index 16cece392..be022b2da 100644 --- a/crates/trie/db/tests/post_state.rs +++ b/crates/trie/db/tests/post_state.rs @@ -1,8 +1,9 @@ +use alloy_primitives::{B256, U256}; use proptest::prelude::*; use proptest_arbitrary_interop::arb; use reth_db::{tables, test_utils::create_test_rw_db}; use reth_db_api::{database::Database, transaction::DbTxMut}; -use reth_primitives::{Account, StorageEntry, B256, U256}; +use reth_primitives::{Account, StorageEntry}; use reth_trie::{ hashed_cursor::{ HashedCursor, HashedCursorFactory, HashedPostStateCursorFactory, HashedStorageCursor, diff --git a/crates/trie/db/tests/proof.rs b/crates/trie/db/tests/proof.rs index db9d708d4..8a31512a7 100644 --- a/crates/trie/db/tests/proof.rs +++ b/crates/trie/db/tests/proof.rs @@ -1,5 +1,6 @@ +use alloy_primitives::{keccak256, Address, Bytes, B256, U256}; use reth_chainspec::{Chain, ChainSpec, HOLESKY, MAINNET}; -use reth_primitives::{constants::EMPTY_ROOT_HASH, keccak256, Account, Address, Bytes, B256, U256}; +use reth_primitives::{constants::EMPTY_ROOT_HASH, Account}; use reth_provider::test_utils::{create_test_provider_factory, insert_genesis}; use reth_trie::{proof::Proof, Nibbles}; use reth_trie_common::{AccountProof, StorageProof}; diff --git a/crates/trie/db/tests/trie.rs b/crates/trie/db/tests/trie.rs index 007ce3069..a6983dc4e 100644 --- a/crates/trie/db/tests/trie.rs +++ b/crates/trie/db/tests/trie.rs @@ -1,3 +1,4 @@ +use alloy_primitives::{keccak256, Address, B256, U256}; use proptest::{prelude::ProptestConfig, proptest}; use proptest_arbitrary_interop::arb; use reth_db::{tables, test_utils::TempDatabase, DatabaseEnv}; @@ -5,7 +6,7 @@ use reth_db_api::{ cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO}, transaction::DbTxMut, }; -use reth_primitives::{hex_literal::hex, Account, StorageEntry, U256}; +use reth_primitives::{constants::EMPTY_ROOT_HASH, hex_literal::hex, Account, StorageEntry}; use reth_provider::{ test_utils::create_test_provider_factory, DatabaseProviderRW, StorageTrieWriter, TrieWriter, }; @@ -25,7 +26,6 @@ use std::{ use alloy_rlp::Encodable; use reth_db_api::transaction::DbTx; -use reth_primitives::{constants::EMPTY_ROOT_HASH, keccak256, Address, B256}; use reth_trie::{ prefix_set::TriePrefixSets, updates::StorageTrieUpdates, HashBuilder, IntermediateStateRootState, Nibbles, StateRootProgress, TrieAccount, diff --git a/crates/trie/db/tests/walker.rs b/crates/trie/db/tests/walker.rs index 19d5c5c32..f018d7f1a 100644 --- a/crates/trie/db/tests/walker.rs +++ b/crates/trie/db/tests/walker.rs @@ -1,6 +1,6 @@ +use alloy_primitives::B256; use reth_db::tables; use reth_db_api::{cursor::DbCursorRW, transaction::DbTxMut}; -use reth_primitives::B256; use reth_provider::test_utils::create_test_provider_factory; use reth_trie::{ prefix_set::PrefixSetMut, trie_cursor::TrieCursor, walker::TrieWalker, StorageTrieEntry, diff --git a/crates/trie/parallel/Cargo.toml b/crates/trie/parallel/Cargo.toml index 92f939dd0..e53d15c14 100644 --- a/crates/trie/parallel/Cargo.toml +++ b/crates/trie/parallel/Cargo.toml @@ -23,6 +23,7 @@ reth-provider.workspace = true # alloy alloy-rlp.workspace = true +alloy-primitives.workspace = true # tracing tracing.workspace = true diff --git a/crates/trie/parallel/benches/root.rs b/crates/trie/parallel/benches/root.rs index 8f5e27480..b8a4d25e5 100644 --- a/crates/trie/parallel/benches/root.rs +++ b/crates/trie/parallel/benches/root.rs @@ -1,9 +1,10 @@ #![allow(missing_docs, unreachable_pub)] +use alloy_primitives::{B256, U256}; use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion}; use proptest::{prelude::*, strategy::ValueTree, test_runner::TestRunner}; use proptest_arbitrary_interop::arb; use rayon::ThreadPoolBuilder; -use reth_primitives::{Account, B256, U256}; +use reth_primitives::Account; use reth_provider::{ providers::ConsistentDbView, test_utils::create_test_provider_factory, StateChangeWriter, TrieWriter, diff --git a/crates/trie/parallel/src/async_root.rs b/crates/trie/parallel/src/async_root.rs index f9206815c..ed12accb4 100644 --- a/crates/trie/parallel/src/async_root.rs +++ b/crates/trie/parallel/src/async_root.rs @@ -1,10 +1,10 @@ #[cfg(feature = "metrics")] use crate::metrics::ParallelStateRootMetrics; use crate::{stats::ParallelTrieTracker, storage_root_targets::StorageRootTargets}; +use alloy_primitives::B256; use alloy_rlp::{BufMut, Encodable}; use itertools::Itertools; use reth_execution_errors::StorageRootError; -use reth_primitives::B256; use reth_provider::{ providers::ConsistentDbView, BlockReader, DBProvider, DatabaseProviderFactory, ProviderError, }; @@ -240,9 +240,10 @@ pub enum AsyncStateRootError { #[cfg(test)] mod tests { use super::*; + use alloy_primitives::{keccak256, Address, U256}; use rand::Rng; use rayon::ThreadPoolBuilder; - use reth_primitives::{keccak256, Account, Address, StorageEntry, U256}; + use reth_primitives::{Account, StorageEntry}; use reth_provider::{test_utils::create_test_provider_factory, HashingWriter}; use reth_trie::{test_utils, HashedPostState, HashedStorage}; diff --git a/crates/trie/parallel/src/parallel_root.rs b/crates/trie/parallel/src/parallel_root.rs index 65d2e386f..e63c3f1a1 100644 --- a/crates/trie/parallel/src/parallel_root.rs +++ b/crates/trie/parallel/src/parallel_root.rs @@ -226,8 +226,9 @@ impl From for ProviderError { #[cfg(test)] mod tests { use super::*; + use alloy_primitives::{keccak256, Address, U256}; use rand::Rng; - use reth_primitives::{keccak256, Account, Address, StorageEntry, U256}; + use reth_primitives::{Account, StorageEntry}; use reth_provider::{test_utils::create_test_provider_factory, HashingWriter}; use reth_trie::{test_utils, HashedPostState, HashedStorage}; diff --git a/crates/trie/parallel/src/storage_root_targets.rs b/crates/trie/parallel/src/storage_root_targets.rs index d34441d3b..8325fbcf7 100644 --- a/crates/trie/parallel/src/storage_root_targets.rs +++ b/crates/trie/parallel/src/storage_root_targets.rs @@ -1,5 +1,5 @@ +use alloy_primitives::B256; use derive_more::{Deref, DerefMut}; -use reth_primitives::B256; use reth_trie::prefix_set::PrefixSet; use std::collections::HashMap;