storage: replace reth-primitive imports with alloy-eips (#10992)

This commit is contained in:
Håvard Anda Estensen
2024-09-18 22:21:27 +02:00
committed by GitHub
parent f64aecfbc8
commit ef06c850e4
23 changed files with 61 additions and 42 deletions

3
Cargo.lock generated
View File

@ -8187,6 +8187,7 @@ dependencies = [
name = "reth-provider"
version = "1.0.7"
dependencies = [
"alloy-eips",
"alloy-primitives",
"alloy-rpc-types-engine",
"assert_matches",
@ -8748,6 +8749,7 @@ dependencies = [
name = "reth-storage-api"
version = "1.0.7"
dependencies = [
"alloy-eips",
"alloy-primitives",
"auto_impl",
"reth-chainspec",
@ -8765,6 +8767,7 @@ dependencies = [
name = "reth-storage-errors"
version = "1.0.7"
dependencies = [
"alloy-eips",
"alloy-primitives",
"alloy-rlp",
"derive_more",

View File

@ -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
@ -24,4 +25,4 @@ derive_more.workspace = true
[features]
default = ["std"]
std = []
std = []

View File

@ -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;

View File

@ -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

View File

@ -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::{
@ -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};
@ -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;
@ -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,

View File

@ -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;
@ -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};

View File

@ -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;
@ -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,
};

View File

@ -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},
@ -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};

View File

@ -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::{

View File

@ -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};
@ -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};

View File

@ -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,
@ -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::{

View File

@ -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,
};
@ -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};

View File

@ -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;

View File

@ -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

View File

@ -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;

View File

@ -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.

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -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.

View File

@ -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`].

View File

@ -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};

View File

@ -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.