Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trie: replace reth_primitives with alloy_primitives #10931

Merged
merged 3 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions crates/trie/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ revm.workspace = true

# alloy
alloy-rlp.workspace = true
alloy-primitives.workspace = true

# tracing
tracing.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/db/src/hashed_cursor.rs
Original file line number Diff line number Diff line change
@@ -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`].
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/db/src/prefix_set.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloy_primitives::{keccak256, BlockNumber, B256};
use derive_more::Deref;
use reth_db::tables;
use reth_db_api::{
Expand All @@ -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::{
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/db/src/proof.rs
Original file line number Diff line number Diff line change
@@ -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, TrieInput,
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/db/src/state.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
use crate::{DatabaseHashedCursorFactory, DatabaseTrieCursorFactory, PrefixSetLoader};
use alloy_primitives::{keccak256, Address, BlockNumber, B256, U256};
use reth_db::tables;
use reth_db_api::{
cursor::DbCursorRO,
models::{AccountBeforeTx, BlockNumberAddress},
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,
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/db/src/storage.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/db/src/trie_cursor.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use alloy_primitives::B256;
use reth_db::{
cursor::{DbCursorRW, DbDupCursorRW},
tables,
Expand All @@ -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},
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/db/src/witness.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/db/tests/fuzz_in_memory_nodes.rs
Original file line number Diff line number Diff line change
@@ -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},
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/db/tests/post_state.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/db/tests/proof.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down
4 changes: 2 additions & 2 deletions crates/trie/db/tests/trie.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
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};
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,
};
Expand All @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion crates/trie/db/tests/walker.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
1 change: 1 addition & 0 deletions crates/trie/parallel/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ reth-provider.workspace = true

# alloy
alloy-rlp.workspace = true
alloy-primitives.workspace = true

# tracing
tracing.workspace = true
Expand Down
3 changes: 2 additions & 1 deletion crates/trie/parallel/benches/root.rs
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
5 changes: 3 additions & 2 deletions crates/trie/parallel/src/async_root.rs
Original file line number Diff line number Diff line change
@@ -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,
};
Expand Down Expand Up @@ -251,9 +251,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, HashedStorage};

Expand Down
3 changes: 2 additions & 1 deletion crates/trie/parallel/src/parallel_root.rs
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ impl From<ParallelStateRootError> 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, HashedStorage};

Expand Down
2 changes: 1 addition & 1 deletion crates/trie/parallel/src/storage_root_targets.rs
Original file line number Diff line number Diff line change
@@ -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;

Expand Down
Loading