Skip to content

Commit

Permalink
storage: replace reth-primitive imports with alloy-eips (#10992)
Browse files Browse the repository at this point in the history
  • Loading branch information
estensen authored Sep 18, 2024
1 parent f64aecf commit ef06c85
Show file tree
Hide file tree
Showing 23 changed files with 61 additions and 42 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

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

5 changes: 3 additions & 2 deletions crates/storage/errors/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ workspace = true
reth-primitives.workspace = true
reth-fs-util.workspace = true

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

Expand All @@ -24,4 +25,4 @@ derive_more.workspace = true

[features]
default = ["std"]
std = []
std = []
3 changes: 2 additions & 1 deletion crates/storage/errors/src/provider.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
use crate::{db::DatabaseError, lockfile::StorageLockError, writer::UnifiedStorageWriterError};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{Address, BlockHash, BlockNumber, TxNumber, B256, U256};
use derive_more::Display;
use reth_primitives::{BlockHashOrNumber, GotExpected, StaticFileSegment, TxHashOrNumber};
use reth_primitives::{GotExpected, StaticFileSegment, TxHashOrNumber};

#[cfg(feature = "std")]
use std::path::PathBuf;
Expand Down
1 change: 1 addition & 0 deletions crates/storage/provider/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ reth-chain-state.workspace = true
reth-node-types.workspace = true

# ethereum
alloy-eips.workspace = true
alloy-primitives.workspace = true
alloy-rpc-types-engine.workspace = true
revm.workspace = true
Expand Down
13 changes: 7 additions & 6 deletions crates/storage/provider/src/providers/blockchain_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
RequestsProvider, StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use alloy_rpc_types_engine::ForkchoiceState;
use reth_chain_state::{
Expand All @@ -20,9 +21,9 @@ use reth_evm::ConfigureEvmEnv;
use reth_execution_types::ExecutionOutcome;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Account, Block, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, BlockWithSenders,
EthereumHardforks, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals,
Account, Block, BlockWithSenders, EthereumHardforks, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, Withdrawal, Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down Expand Up @@ -1395,6 +1396,7 @@ mod tests {
writer::UnifiedStorageWriter,
BlockWriter, CanonChainTracker, StaticFileProviderFactory, StaticFileWriter,
};
use alloy_eips::{BlockHashOrNumber, BlockNumHash, BlockNumberOrTag};
use alloy_primitives::B256;
use itertools::Itertools;
use rand::Rng;
Expand All @@ -1408,9 +1410,8 @@ mod tests {
use reth_db::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{
BlockHashOrNumber, BlockNumHash, BlockNumberOrTag, BlockWithSenders, Receipt, SealedBlock,
SealedBlockWithSenders, StaticFileSegment, TransactionMeta, TransactionSignedNoHash,
Withdrawals,
BlockWithSenders, Receipt, SealedBlock, SealedBlockWithSenders, StaticFileSegment,
TransactionMeta, TransactionSignedNoHash, Withdrawals,
};
use reth_storage_api::{
BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, BlockReaderIdExt, BlockSource,
Expand Down
7 changes: 4 additions & 3 deletions crates/storage/provider/src/providers/database/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
PruneCheckpointReader, RequestsProvider, StageCheckpointReader, StateProviderBox,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use core::fmt;
use reth_chainspec::ChainInfo;
Expand All @@ -16,9 +17,9 @@ use reth_errors::{RethError, RethResult};
use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Block, BlockHashOrNumber, BlockWithSenders, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, StaticFileSegment, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, Withdrawal, Withdrawals,
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal,
Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
5 changes: 3 additions & 2 deletions crates/storage/provider/src/providers/database/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ use crate::{
StatsReader, StorageReader, StorageTrieWriter, TransactionVariant, TransactionsProvider,
TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use itertools::{izip, Itertools};
use rayon::slice::ParallelSliceMut;
Expand All @@ -38,8 +39,8 @@ use reth_evm::ConfigureEvmEnv;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_network_p2p::headers::downloader::SyncTarget;
use reth_primitives::{
Account, Block, BlockHashOrNumber, BlockWithSenders, Bytecode, GotExpected, Header, Receipt,
Requests, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
Account, Block, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, Requests,
SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
Withdrawal, Withdrawals,
};
Expand Down
7 changes: 4 additions & 3 deletions crates/storage/provider/src/providers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider,
};
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use reth_blockchain_tree_api::{
error::{CanonicalError, InsertBlockError},
Expand All @@ -20,9 +21,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Account, Block, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, BlockWithSenders,
Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta,
TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals,
Account, Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal,
Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
4 changes: 2 additions & 2 deletions crates/storage/provider/src/providers/static_file/jar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ use crate::{
to_range, BlockHashReader, BlockNumReader, HeaderProvider, ReceiptProvider,
TransactionsProvider,
};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use reth_chainspec::ChainInfo;
use reth_db::static_file::{HeaderMask, ReceiptMask, StaticFileCursor, TransactionMask};
use reth_db_api::models::CompactU256;
use reth_primitives::{
BlockHashOrNumber, Header, Receipt, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash,
Header, Receipt, SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{
Expand Down
7 changes: 4 additions & 3 deletions crates/storage/provider/src/providers/static_file/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use crate::{
HeaderProvider, ReceiptProvider, RequestsProvider, StageCheckpointReader, StatsReader,
TransactionVariant, TransactionsProvider, TransactionsProviderExt, WithdrawalsProvider,
};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use dashmap::DashMap;
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
Expand All @@ -27,9 +28,9 @@ use reth_db_api::{
use reth_nippy_jar::{NippyJar, NippyJarChecker, CONFIG_FILE_EXTENSION};
use reth_primitives::{
static_file::{find_fixed_range, HighestStaticFiles, SegmentHeader, SegmentRangeInclusive},
Block, BlockHashOrNumber, BlockWithSenders, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, StaticFileSegment, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, Withdrawal, Withdrawals,
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
StaticFileSegment, TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal,
Withdrawals,
};
use reth_stages_types::{PipelineTarget, StageId};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
Expand Down
7 changes: 4 additions & 3 deletions crates/storage/provider/src/test_utils/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::{
StateProviderBox, StateProviderFactory, StateReader, StateRootProvider, TransactionVariant,
TransactionsProvider, WithdrawalsProvider,
};
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{
keccak256, Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber,
B256, U256,
Expand All @@ -17,9 +18,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{
Account, Block, BlockHashOrNumber, BlockId, BlockNumberOrTag, BlockWithSenders, Bytecode,
GotExpected, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals,
Account, Block, BlockWithSenders, Bytecode, GotExpected, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, Withdrawal, Withdrawals,
};
use reth_stages_types::{StageCheckpoint, StageId};
use reth_storage_api::{
Expand Down
7 changes: 4 additions & 3 deletions crates/storage/provider/src/test_utils/noop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use std::{
sync::Arc,
};

use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{
Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber, B256, U256,
};
Expand All @@ -16,9 +17,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_errors::ProviderError;
use reth_evm::ConfigureEvmEnv;
use reth_primitives::{
Account, Block, BlockHashOrNumber, BlockId, BlockNumberOrTag, BlockWithSenders, Bytecode,
Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, TransactionMeta,
TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals,
Account, Block, BlockWithSenders, Bytecode, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, Withdrawal, Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};
Expand Down
3 changes: 2 additions & 1 deletion crates/storage/provider/src/traits/header_sync_gap.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{BlockNumber, B256};
use reth_network_p2p::headers::downloader::SyncTarget;
use reth_primitives::{BlockHashOrNumber, SealedHeader};
use reth_primitives::SealedHeader;
use reth_storage_errors::provider::ProviderResult;
use tokio::sync::watch;

Expand Down
3 changes: 2 additions & 1 deletion crates/storage/storage-api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ reth-stages-types.workspace = true
reth-storage-errors.workspace = true
reth-trie.workspace = true

# alloy
# ethereum
alloy-eips.workspace = true
alloy-primitives.workspace = true

auto_impl.workspace = true
4 changes: 2 additions & 2 deletions crates/storage/storage-api/src/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ use crate::{
BlockIdReader, BlockNumReader, HeaderProvider, ReceiptProvider, ReceiptProviderIdExt,
RequestsProvider, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{BlockNumber, B256};
use reth_db_models::StoredBlockBodyIndices;
use reth_primitives::{
Block, BlockHashOrNumber, BlockId, BlockNumberOrTag, BlockWithSenders, Header, Receipt,
SealedBlock, SealedBlockWithSenders, SealedHeader,
Block, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
};
use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeInclusive;
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/storage-api/src/block_hash.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{BlockNumber, B256};
use reth_primitives::BlockHashOrNumber;
use reth_storage_errors::provider::ProviderResult;

/// Client trait for fetching block hashes by number.
Expand Down
2 changes: 1 addition & 1 deletion crates/storage/storage-api/src/block_id.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::BlockHashReader;
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{BlockNumber, B256};
use reth_chainspec::ChainInfo;
use reth_primitives::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use reth_storage_errors::provider::{ProviderError, ProviderResult};

/// Client trait for getting important block numbers (such as the latest block number), converting
Expand Down
3 changes: 2 additions & 1 deletion crates/storage/storage-api/src/header.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{BlockHash, BlockNumber, U256};
use reth_primitives::{BlockHashOrNumber, Header, SealedHeader};
use reth_primitives::{Header, SealedHeader};
use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeBounds;

Expand Down
3 changes: 2 additions & 1 deletion crates/storage/storage-api/src/receipts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::BlockIdReader;
use alloy_eips::{BlockHashOrNumber, BlockId, BlockNumberOrTag};
use alloy_primitives::{BlockNumber, TxHash, TxNumber};
use reth_primitives::{BlockHashOrNumber, BlockId, BlockNumberOrTag, Receipt};
use reth_primitives::Receipt;
use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeBounds;

Expand Down
3 changes: 2 additions & 1 deletion crates/storage/storage-api/src/requests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use reth_primitives::{BlockHashOrNumber, Requests};
use alloy_eips::BlockHashOrNumber;
use reth_primitives::Requests;
use reth_storage_errors::provider::ProviderResult;

/// Client trait for fetching EIP-7685 [Requests] for blocks.
Expand Down
3 changes: 2 additions & 1 deletion crates/storage/storage-api/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ use super::{
AccountReader, BlockHashReader, BlockIdReader, StateProofProvider, StateRootProvider,
StorageRootProvider,
};
use alloy_eips::{BlockId, BlockNumHash, BlockNumberOrTag};
use alloy_primitives::{Address, BlockHash, BlockNumber, StorageKey, StorageValue, B256, U256};
use auto_impl::auto_impl;
use reth_execution_types::ExecutionOutcome;
use reth_primitives::{BlockId, BlockNumHash, BlockNumberOrTag, Bytecode, KECCAK_EMPTY};
use reth_primitives::{Bytecode, KECCAK_EMPTY};
use reth_storage_errors::provider::{ProviderError, ProviderResult};

/// Type alias of boxed [`StateProvider`].
Expand Down
5 changes: 2 additions & 3 deletions crates/storage/storage-api/src/transactions.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::{BlockNumReader, BlockReader};
use alloy_eips::BlockHashOrNumber;
use alloy_primitives::{Address, BlockNumber, TxHash, TxNumber};
use reth_primitives::{
BlockHashOrNumber, TransactionMeta, TransactionSigned, TransactionSignedNoHash,
};
use reth_primitives::{TransactionMeta, TransactionSigned, TransactionSignedNoHash};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::ops::{Range, RangeBounds, RangeInclusive};

Expand Down
3 changes: 2 additions & 1 deletion crates/storage/storage-api/src/withdrawals.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use reth_primitives::{BlockHashOrNumber, Withdrawal, Withdrawals};
use alloy_eips::BlockHashOrNumber;
use reth_primitives::{Withdrawal, Withdrawals};
use reth_storage_errors::provider::ProviderResult;

/// Client trait for fetching [Withdrawal] related data.
Expand Down

0 comments on commit ef06c85

Please sign in to comment.