storage: replace reth-primitive imports (#10981)

Co-authored-by: Matthias Seitz <matthias.seitz@outlook.de>
This commit is contained in:
Håvard Anda Estensen
2024-09-18 18:14:53 +02:00
committed by GitHub
parent a92017bddb
commit 80c1159cb8
49 changed files with 141 additions and 107 deletions

View File

@ -22,6 +22,9 @@ reth-stages-types.workspace = true
reth-storage-errors.workspace = true
reth-trie-common.workspace = true
# ethereum
alloy-primitives.workspace = true
# codecs
modular-bitfield.workspace = true
parity-scale-codec = { version = "3.2.1", features = ["bytes"] }

View File

@ -7,7 +7,7 @@ use crate::{
table::{Decode, Encode},
DatabaseError,
};
use reth_primitives::{Address, BlockNumber, StorageKey};
use alloy_primitives::{Address, BlockNumber, StorageKey};
use serde::{Deserialize, Serialize};
/// [`BlockNumber`] concatenated with [`Address`].

View File

@ -1,7 +1,8 @@
//! Block related models and types.
use alloy_primitives::B256;
use reth_codecs::{add_arbitrary_tests, Compact};
use reth_primitives::{Header, B256};
use reth_primitives::Header;
use serde::{Deserialize, Serialize};
/// The storage representation of a block's ommers.

View File

@ -4,8 +4,12 @@ use crate::{
table::{Compress, Decode, Decompress, Encode},
DatabaseError,
};
use alloy_primitives::{Address, Log, B256, U256};
use reth_codecs::{add_arbitrary_tests, Compact};
use reth_primitives::{Address, B256, *};
use reth_primitives::{
Account, Bytecode, GenesisAccount, Header, Receipt, Requests, SealedHeader, StorageEntry,
TransactionSignedNoHash, TxType,
};
use reth_prune_types::{PruneCheckpoint, PruneSegment};
use reth_stages_types::StageCheckpoint;
use reth_trie_common::{StoredNibbles, StoredNibblesSubKey, *};

View File

@ -3,7 +3,7 @@ use crate::{
table::{Decode, Encode},
DatabaseError,
};
use reth_primitives::BlockNumber;
use alloy_primitives::BlockNumber;
use serde::{Deserialize, Serialize};
use std::hash::Hash;

View File

@ -3,8 +3,8 @@ use crate::{
table::{Decode, Encode},
DatabaseError,
};
use alloy_primitives::{Address, BlockNumber, B256};
use derive_more::AsRef;
use reth_primitives::{Address, BlockNumber, B256};
use serde::{Deserialize, Serialize};
use super::ShardedKey;

View File

@ -2,7 +2,7 @@ use crate::{
table::{Compress, Decompress},
DatabaseError,
};
use reth_primitives::*;
use alloy_primitives::U256;
mod sealed {
pub trait Sealed {}

View File

@ -16,6 +16,9 @@ workspace = true
reth-codecs.workspace = true
reth-primitives = { workspace = true, features = ["reth-codec"] }
# ethereum
alloy-primitives.workspace = true
# codecs
modular-bitfield.workspace = true
serde = { workspace = true, default-features = false }

View File

@ -1,7 +1,8 @@
use reth_codecs::{add_arbitrary_tests, Compact};
use serde::Serialize;
use reth_primitives::{Account, Address, Buf};
use alloy_primitives::Address;
use reth_primitives::{Account, Buf};
/// Account as it is saved in the database.
///

View File

@ -1,7 +1,8 @@
use std::ops::Range;
use alloy_primitives::TxNumber;
use reth_codecs::{add_arbitrary_tests, Compact};
use reth_primitives::{TxNumber, Withdrawals};
use reth_primitives::Withdrawals;
use serde::{Deserialize, Serialize};
/// Total number of transactions.

View File

@ -24,6 +24,9 @@ reth-stages-types.workspace = true
reth-tracing.workspace = true
reth-trie-common.workspace = true
# ethereum
alloy-primitives.workspace = true
# mdbx
reth-libmdbx = { workspace = true, optional = true, features = [
"return-borrowed",

View File

@ -1,3 +1,4 @@
use alloy_primitives::Bytes;
use reth_db::{test_utils::create_test_rw_db_with_path, DatabaseEnv};
use reth_db_api::{
database::Database,
@ -5,7 +6,6 @@ use reth_db_api::{
transaction::DbTxMut,
};
use reth_fs_util as fs;
use reth_primitives::Bytes;
use std::{path::Path, sync::Arc};
/// Path where the DB is initialized for benchmarks.

View File

@ -476,13 +476,14 @@ mod tests {
test_utils::*,
AccountChangeSets,
};
use alloy_primitives::{Address, B256, U256};
use reth_db_api::{
cursor::{DbDupCursorRO, DbDupCursorRW, ReverseWalker, Walker},
models::{AccountBeforeTx, ShardedKey},
table::{Encode, Table},
};
use reth_libmdbx::Error;
use reth_primitives::{Account, Address, Header, StorageEntry, B256, U256};
use reth_primitives::{Account, Header, StorageEntry};
use reth_primitives_traits::IntegerList;
use reth_storage_errors::db::{DatabaseWriteError, DatabaseWriteOperation};
use std::str::FromStr;

View File

@ -1,8 +1,9 @@
use super::mask::{ColumnSelectorOne, ColumnSelectorThree, ColumnSelectorTwo};
use alloy_primitives::B256;
use derive_more::{Deref, DerefMut};
use reth_db_api::table::Decompress;
use reth_nippy_jar::{DataReader, NippyJar, NippyJarCursor};
use reth_primitives::{static_file::SegmentHeader, B256};
use reth_primitives::static_file::SegmentHeader;
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::sync::Arc;

View File

@ -4,8 +4,9 @@ use crate::{
static_file::mask::{ColumnSelectorOne, ColumnSelectorTwo, HeaderMask},
HeaderTerminalDifficulties, RawValue, Receipts, Transactions,
};
use alloy_primitives::BlockHash;
use reth_db_api::table::Table;
use reth_primitives::{BlockHash, Header};
use reth_primitives::Header;
// HEADER MASKS
add_static_file_mask!(HeaderMask, Header, 0b001);

View File

@ -17,7 +17,7 @@ macro_rules! impl_fuzzer_with_input {
use reth_db_api::table;
#[allow(unused_imports)]
use reth_primitives::*;
#[allow(unused_imports)]
use reth_primitives_traits::*;

View File

@ -19,6 +19,7 @@ pub use raw::{RawDupSort, RawKey, RawTable, RawValue, TableRawRow};
#[cfg(feature = "mdbx")]
pub(crate) mod utils;
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256};
use reth_db_api::{
models::{
accounts::BlockNumberAddress,
@ -30,8 +31,7 @@ use reth_db_api::{
table::{Decode, DupSort, Encode, Table},
};
use reth_primitives::{
Account, Address, BlockHash, BlockNumber, Bytecode, Header, Receipt, Requests, StorageEntry,
TransactionSignedNoHash, TxHash, TxNumber, B256,
Account, Bytecode, Header, Receipt, Requests, StorageEntry, TransactionSignedNoHash,
};
use reth_primitives_traits::IntegerList;
use reth_prune_types::{PruneCheckpoint, PruneSegment};

View File

@ -106,7 +106,7 @@ impl fmt::Display for DatabaseWriteError {
f,
"write operation {:?} failed for key \"{}\" in table {}: {}",
self.operation,
reth_primitives::hex::encode(&self.key),
alloy_primitives::hex::encode(&self.key),
self.table_name,
self.info
)

View File

@ -35,6 +35,7 @@ reth-chain-state.workspace = true
reth-node-types.workspace = true
# ethereum
alloy-primitives.workspace = true
alloy-rpc-types-engine.workspace = true
revm.workspace = true

View File

@ -1,4 +1,4 @@
use reth_primitives::{B256, U256};
use alloy_primitives::{B256, U256};
use revm::db::states::RevertToSlot;
use std::iter::Peekable;

View File

@ -7,6 +7,7 @@ use crate::{
RequestsProvider, StageCheckpointReader, StateProviderBox, StateProviderFactory, StateReader,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use alloy_rpc_types_engine::ForkchoiceState;
use reth_chain_state::{
BlockState, CanonicalInMemoryState, ForkChoiceNotifications, ForkChoiceSubscriptions,
@ -19,10 +20,9 @@ use reth_evm::ConfigureEvmEnv;
use reth_execution_types::ExecutionOutcome;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumber,
BlockNumberOrTag, BlockWithSenders, EthereumHardforks, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256, U256,
Account, Block, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, 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 +1395,7 @@ mod tests {
writer::UnifiedStorageWriter,
BlockWriter, CanonChainTracker, StaticFileProviderFactory, StaticFileWriter,
};
use alloy_primitives::B256;
use itertools::Itertools;
use rand::Rng;
use reth_chain_state::{
@ -1409,7 +1410,7 @@ mod tests {
use reth_primitives::{
BlockHashOrNumber, BlockNumHash, BlockNumberOrTag, BlockWithSenders, Receipt, SealedBlock,
SealedBlockWithSenders, StaticFileSegment, TransactionMeta, TransactionSignedNoHash,
Withdrawals, B256,
Withdrawals,
};
use reth_storage_api::{
BlockHashReader, BlockIdReader, BlockNumReader, BlockReader, BlockReaderIdExt, BlockSource,

View File

@ -1,7 +1,8 @@
use crate::{
AccountReader, BlockHashReader, ExecutionDataProvider, StateProvider, StateRootProvider,
};
use reth_primitives::{Account, Address, BlockNumber, Bytecode, Bytes, B256};
use alloy_primitives::{Address, BlockNumber, Bytes, B256};
use reth_primitives::{Account, Bytecode};
use reth_storage_api::{StateProofProvider, StorageRootProvider};
use reth_storage_errors::provider::ProviderResult;
use reth_trie::{
@ -160,8 +161,8 @@ impl<SP: StateProvider, EDP: ExecutionDataProvider> StateProvider for BundleStat
fn storage(
&self,
account: Address,
storage_key: reth_primitives::StorageKey,
) -> ProviderResult<Option<reth_primitives::StorageValue>> {
storage_key: alloy_primitives::StorageKey,
) -> ProviderResult<Option<alloy_primitives::StorageValue>> {
let u256_storage_key = storage_key.into();
if let Some(value) = self
.block_execution_data_provider

View File

@ -1,8 +1,10 @@
use crate::{BlockNumReader, DatabaseProviderFactory, HeaderProvider};
use alloy_primitives::B256;
use reth_errors::ProviderError;
use reth_primitives::{GotExpected, B256};
use reth_primitives::GotExpected;
use reth_storage_api::{BlockReader, DBProvider};
use reth_storage_errors::provider::ProviderResult;
use reth_trie::HashedPostState;
use reth_trie_db::DatabaseHashedPostState;

View File

@ -7,6 +7,7 @@ use crate::{
PruneCheckpointReader, RequestsProvider, StageCheckpointReader, StateProviderBox,
StaticFileProviderFactory, TransactionVariant, TransactionsProvider, WithdrawalsProvider,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use core::fmt;
use reth_chainspec::ChainInfo;
use reth_db::{init_db, mdbx::DatabaseArguments, DatabaseEnv};
@ -15,10 +16,9 @@ use reth_errors::{RethError, RethResult};
use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, Header, Receipt,
SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, TransactionMeta,
TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256,
U256,
Block, BlockHashOrNumber, 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};
@ -633,6 +633,7 @@ mod tests {
test_utils::{blocks::TEST_BLOCK, create_test_provider_factory, MockNodeTypesWithDB},
BlockHashReader, BlockNumReader, BlockWriter, HeaderSyncGapProvider, TransactionsProvider,
};
use alloy_primitives::{TxNumber, B256, U256};
use assert_matches::assert_matches;
use rand::Rng;
use reth_chainspec::ChainSpecBuilder;
@ -641,7 +642,7 @@ mod tests {
tables,
test_utils::{create_test_static_files_dir, ERROR_TEMPDIR},
};
use reth_primitives::{StaticFileSegment, TxNumber, B256, U256};
use reth_primitives::StaticFileSegment;
use reth_prune_types::{PruneMode, PruneModes};
use reth_storage_errors::provider::ProviderError;
use reth_testing_utils::generators::{self, random_block, random_header, BlockParams};

View File

@ -15,6 +15,7 @@ use crate::{
StatsReader, StorageReader, StorageTrieWriter, TransactionVariant, TransactionsProvider,
TransactionsProviderExt, TrieWriter, WithdrawalsProvider,
};
use alloy_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use itertools::{izip, Itertools};
use rayon::slice::ParallelSliceMut;
use reth_chainspec::{ChainInfo, ChainSpec, EthereumHardforks};
@ -37,11 +38,10 @@ use reth_evm::ConfigureEvmEnv;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_network_p2p::headers::downloader::SyncTarget;
use reth_primitives::{
keccak256, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockNumber,
BlockWithSenders, Bytecode, GotExpected, Header, Receipt, Requests, SealedBlock,
SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry, TransactionMeta,
TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash, TxHash, TxNumber,
Withdrawal, Withdrawals, B256, U256,
Account, Block, BlockHashOrNumber, BlockWithSenders, Bytecode, GotExpected, Header, Receipt,
Requests, SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, StorageEntry,
TransactionMeta, TransactionSigned, TransactionSignedEcRecovered, TransactionSignedNoHash,
Withdrawal, Withdrawals,
};
use reth_prune_types::{PruneCheckpoint, PruneModes, PruneSegment};
use reth_stages_types::{StageCheckpoint, StageId};

View File

@ -7,6 +7,7 @@ use crate::{
StageCheckpointReader, StateProviderBox, StateProviderFactory, StaticFileProviderFactory,
TransactionVariant, TransactionsProvider, TreeViewer, WithdrawalsProvider,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use reth_blockchain_tree_api::{
error::{CanonicalError, InsertBlockError},
BlockValidationKind, BlockchainTreeEngine, BlockchainTreeViewer, CanonicalOutcome,
@ -19,10 +20,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_node_types::NodeTypesWithDB;
use reth_primitives::{
Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumber,
BlockNumberOrTag, BlockWithSenders, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, TransactionMeta, TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber,
Withdrawal, Withdrawals, B256, U256,
Account, Block, BlockHashOrNumber, BlockId, BlockNumHash, BlockNumberOrTag, 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

@ -2,6 +2,7 @@ use crate::{
providers::{state::macros::delegate_provider_impls, StaticFileProvider},
AccountReader, BlockHashReader, ProviderError, StateProvider, StateRootProvider,
};
use alloy_primitives::{Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
use reth_db::{tables, BlockNumberList};
use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO},
@ -9,10 +10,7 @@ use reth_db_api::{
table::Table,
transaction::DbTx,
};
use reth_primitives::{
constants::EPOCH_SLOTS, Account, Address, BlockNumber, Bytecode, Bytes, StaticFileSegment,
StorageKey, StorageValue, B256,
};
use reth_primitives::{constants::EPOCH_SLOTS, Account, Bytecode, StaticFileSegment};
use reth_storage_api::{StateProofProvider, StorageRootProvider};
use reth_storage_errors::provider::ProviderResult;
use reth_trie::{
@ -496,12 +494,13 @@ mod tests {
AccountReader, HistoricalStateProvider, HistoricalStateProviderRef, StateProvider,
StaticFileProviderFactory,
};
use alloy_primitives::{address, b256, Address, B256, U256};
use reth_db::{tables, BlockNumberList};
use reth_db_api::{
models::{storage_sharded_key::StorageShardedKey, AccountBeforeTx, ShardedKey},
transaction::{DbTx, DbTxMut},
};
use reth_primitives::{address, b256, Account, Address, StorageEntry, B256, U256};
use reth_primitives::{Account, StorageEntry};
use reth_storage_errors::provider::ProviderError;
const ADDRESS: Address = address!("0000000000000000000000000000000000000001");

View File

@ -2,15 +2,13 @@ use crate::{
providers::{state::macros::delegate_provider_impls, StaticFileProvider},
AccountReader, BlockHashReader, StateProvider, StateRootProvider,
};
use alloy_primitives::{Address, BlockNumber, Bytes, StorageKey, StorageValue, B256};
use reth_db::tables;
use reth_db_api::{
cursor::{DbCursorRO, DbDupCursorRO},
transaction::DbTx,
};
use reth_primitives::{
Account, Address, BlockNumber, Bytecode, Bytes, StaticFileSegment, StorageKey, StorageValue,
B256,
};
use reth_primitives::{Account, Bytecode, StaticFileSegment};
use reth_storage_api::{StateProofProvider, StorageRootProvider};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use reth_trie::{

View File

@ -31,29 +31,29 @@ macro_rules! delegate_provider_impls {
$crate::providers::state::macros::delegate_impls_to_as_ref!(
for $target =>
AccountReader $(where [$($generics)*])? {
fn basic_account(&self, address: reth_primitives::Address) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::Account>>;
fn basic_account(&self, address: alloy_primitives::Address) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::Account>>;
}
BlockHashReader $(where [$($generics)*])? {
fn block_hash(&self, number: u64) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::B256>>;
fn canonical_hashes_range(&self, start: reth_primitives::BlockNumber, end: reth_primitives::BlockNumber) -> reth_storage_errors::provider::ProviderResult<Vec<reth_primitives::B256>>;
fn block_hash(&self, number: u64) -> reth_storage_errors::provider::ProviderResult<Option<alloy_primitives::B256>>;
fn canonical_hashes_range(&self, start: alloy_primitives::BlockNumber, end: alloy_primitives::BlockNumber) -> reth_storage_errors::provider::ProviderResult<Vec<alloy_primitives::B256>>;
}
StateProvider $(where [$($generics)*])? {
fn storage(&self, account: reth_primitives::Address, storage_key: reth_primitives::StorageKey) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::StorageValue>>;
fn bytecode_by_hash(&self, code_hash: reth_primitives::B256) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::Bytecode>>;
fn storage(&self, account: alloy_primitives::Address, storage_key: alloy_primitives::StorageKey) -> reth_storage_errors::provider::ProviderResult<Option<alloy_primitives::StorageValue>>;
fn bytecode_by_hash(&self, code_hash: alloy_primitives::B256) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::Bytecode>>;
}
StateRootProvider $(where [$($generics)*])? {
fn state_root(&self, state: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<reth_primitives::B256>;
fn state_root_from_nodes(&self, input: reth_trie::TrieInput) -> reth_storage_errors::provider::ProviderResult<reth_primitives::B256>;
fn state_root_with_updates(&self, state: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<(reth_primitives::B256, reth_trie::updates::TrieUpdates)>;
fn state_root_from_nodes_with_updates(&self, input: reth_trie::TrieInput) -> reth_storage_errors::provider::ProviderResult<(reth_primitives::B256, reth_trie::updates::TrieUpdates)>;
fn state_root(&self, state: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<alloy_primitives::B256>;
fn state_root_from_nodes(&self, input: reth_trie::TrieInput) -> reth_storage_errors::provider::ProviderResult<alloy_primitives::B256>;
fn state_root_with_updates(&self, state: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<(alloy_primitives::B256, reth_trie::updates::TrieUpdates)>;
fn state_root_from_nodes_with_updates(&self, input: reth_trie::TrieInput) -> reth_storage_errors::provider::ProviderResult<(alloy_primitives::B256, reth_trie::updates::TrieUpdates)>;
}
StorageRootProvider $(where [$($generics)*])? {
fn storage_root(&self, address: reth_primitives::Address, storage: reth_trie::HashedStorage) -> reth_storage_errors::provider::ProviderResult<reth_primitives::B256>;
fn storage_root(&self, address: alloy_primitives::Address, storage: reth_trie::HashedStorage) -> reth_storage_errors::provider::ProviderResult<alloy_primitives::B256>;
}
StateProofProvider $(where [$($generics)*])? {
fn proof(&self, input: reth_trie::TrieInput, address: reth_primitives::Address, slots: &[reth_primitives::B256]) -> reth_storage_errors::provider::ProviderResult<reth_trie::AccountProof>;
fn multiproof(&self, input: reth_trie::TrieInput, targets: std::collections::HashMap<reth_primitives::B256, std::collections::HashSet<reth_primitives::B256>>) -> reth_storage_errors::provider::ProviderResult<reth_trie::MultiProof>;
fn witness(&self, input: reth_trie::TrieInput, target: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<std::collections::HashMap<reth_primitives::B256, reth_primitives::Bytes>>;
fn proof(&self, input: reth_trie::TrieInput, address: alloy_primitives::Address, slots: &[alloy_primitives::B256]) -> reth_storage_errors::provider::ProviderResult<reth_trie::AccountProof>;
fn multiproof(&self, input: reth_trie::TrieInput, targets: std::collections::HashMap<reth_primitives::B256, std::collections::HashSet<alloy_primitives::B256>>) -> reth_storage_errors::provider::ProviderResult<reth_trie::MultiProof>;
fn witness(&self, input: reth_trie::TrieInput, target: reth_trie::HashedPostState) -> reth_storage_errors::provider::ProviderResult<std::collections::HashMap<alloy_primitives::B256, alloy_primitives::Bytes>>;
}
);
}

View File

@ -6,12 +6,13 @@ use crate::{
to_range, BlockHashReader, BlockNumReader, HeaderProvider, ReceiptProvider,
TransactionsProvider,
};
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::{
Address, BlockHash, BlockHashOrNumber, BlockNumber, Header, Receipt, SealedHeader,
TransactionMeta, TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, B256, U256,
BlockHashOrNumber, 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_primitives::{keccak256, Address, BlockHash, BlockNumber, TxHash, TxNumber, B256, U256};
use dashmap::DashMap;
use notify::{RecommendedWatcher, RecursiveMode, Watcher};
use parking_lot::RwLock;
@ -25,12 +26,10 @@ use reth_db_api::{
};
use reth_nippy_jar::{NippyJar, NippyJarChecker, CONFIG_FILE_EXTENSION};
use reth_primitives::{
keccak256,
static_file::{find_fixed_range, HighestStaticFiles, SegmentHeader, SegmentRangeInclusive},
Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, Header, Receipt,
SealedBlock, SealedBlockWithSenders, SealedHeader, StaticFileSegment, TransactionMeta,
TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256,
U256,
Block, BlockHashOrNumber, 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

@ -58,10 +58,11 @@ impl Deref for LoadedJar {
mod tests {
use super::*;
use crate::{test_utils::create_test_provider_factory, HeaderProvider};
use alloy_primitives::{B256, U256};
use rand::seq::SliceRandom;
use reth_db::{CanonicalHeaders, HeaderNumbers, HeaderTerminalDifficulties, Headers};
use reth_db_api::transaction::DbTxMut;
use reth_primitives::{static_file::find_fixed_range, B256, U256};
use reth_primitives::static_file::find_fixed_range;
use reth_testing_utils::generators::{self, random_header_range};
#[test]

View File

@ -2,14 +2,14 @@ use super::{
manager::StaticFileProviderInner, metrics::StaticFileProviderMetrics, StaticFileProvider,
};
use crate::providers::static_file::metrics::StaticFileProviderOperation;
use alloy_primitives::{BlockHash, BlockNumber, TxNumber, U256};
use parking_lot::{lock_api::RwLockWriteGuard, RawRwLock, RwLock};
use reth_codecs::Compact;
use reth_db_api::models::CompactU256;
use reth_nippy_jar::{NippyJar, NippyJarError, NippyJarWriter};
use reth_primitives::{
static_file::{find_fixed_range, SegmentHeader, SegmentRangeInclusive},
BlockHash, BlockNumber, Header, Receipt, StaticFileSegment, TransactionSignedNoHash, TxNumber,
U256,
Header, Receipt, StaticFileSegment, TransactionSignedNoHash,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{

View File

@ -1,13 +1,14 @@
//! Dummy blocks and data for tests
use crate::{DatabaseProviderRW, ExecutionOutcome};
use alloy_primitives::Log;
use alloy_primitives::{
b256, hex_literal::hex, Address, BlockNumber, Bytes, Log, TxKind, B256, U256,
};
use once_cell::sync::Lazy;
use reth_db::tables;
use reth_db_api::{database::Database, models::StoredBlockBodyIndices};
use reth_primitives::{
alloy_primitives, b256, hex_literal::hex, Account, Address, BlockNumber, Bytes, Header,
Receipt, Requests, SealedBlock, SealedBlockWithSenders, SealedHeader, Signature, Transaction,
TransactionSigned, TxKind, TxLegacy, TxType, Withdrawal, Withdrawals, B256, U256,
Account, Header, Receipt, Requests, SealedBlock, SealedBlockWithSenders, SealedHeader,
Signature, Transaction, TransactionSigned, TxLegacy, TxType, Withdrawal, Withdrawals,
};
use reth_trie::root::{state_root_unhashed, storage_root_unhashed};
use revm::{

View File

@ -6,6 +6,10 @@ use crate::{
StateProviderBox, StateProviderFactory, StateReader, StateRootProvider, TransactionVariant,
TransactionsProvider, WithdrawalsProvider,
};
use alloy_primitives::{
keccak256, Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber,
B256, U256,
};
use parking_lot::Mutex;
use reth_chainspec::{ChainInfo, ChainSpec};
use reth_db::mock::{DatabaseMock, TxMock};
@ -13,11 +17,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{
keccak256, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, BlockNumber,
BlockNumberOrTag, BlockWithSenders, Bytecode, Bytes, GotExpected, Header, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, StorageKey, StorageValue, TransactionMeta,
TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256,
U256,
Account, Block, BlockHashOrNumber, BlockId, BlockNumberOrTag, BlockWithSenders, Bytecode,
GotExpected, Header, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader,
TransactionMeta, TransactionSigned, TransactionSignedNoHash, Withdrawal, Withdrawals,
};
use reth_stages_types::{StageCheckpoint, StageId};
use reth_storage_api::{
@ -308,7 +310,7 @@ impl TransactionsProvider for MockEthProvider {
fn transactions_by_block_range(
&self,
range: impl RangeBounds<reth_primitives::BlockNumber>,
range: impl RangeBounds<alloy_primitives::BlockNumber>,
) -> ProviderResult<Vec<Vec<TransactionSigned>>> {
// init btreemap so we can return in order
let mut map = BTreeMap::new();
@ -439,7 +441,7 @@ impl BlockNumReader for MockEthProvider {
self.best_block_number()
}
fn block_number(&self, hash: B256) -> ProviderResult<Option<reth_primitives::BlockNumber>> {
fn block_number(&self, hash: B256) -> ProviderResult<Option<alloy_primitives::BlockNumber>> {
let lock = self.blocks.lock();
let num = lock.iter().find_map(|(h, b)| (*h == hash).then_some(b.number));
Ok(num)

View File

@ -1,4 +1,5 @@
use crate::{providers::StaticFileProvider, HashingWriter, ProviderFactory, TrieWriter};
use alloy_primitives::B256;
use reth_chainspec::{ChainSpec, MAINNET};
use reth_db::{
test_utils::{create_test_rw_db, create_test_static_files_dir, TempDatabase},
@ -6,7 +7,7 @@ use reth_db::{
};
use reth_errors::ProviderResult;
use reth_node_types::{NodeTypesWithDB, NodeTypesWithDBAdapter};
use reth_primitives::{Account, StorageEntry, B256};
use reth_primitives::{Account, StorageEntry};
use reth_trie::StateRoot;
use reth_trie_db::DatabaseStateRoot;
use std::sync::Arc;

View File

@ -4,6 +4,9 @@ use std::{
sync::Arc,
};
use alloy_primitives::{
Address, BlockHash, BlockNumber, Bytes, StorageKey, StorageValue, TxHash, TxNumber, B256, U256,
};
use reth_chain_state::{
CanonStateNotifications, CanonStateSubscriptions, ForkChoiceNotifications,
ForkChoiceSubscriptions,
@ -13,10 +16,9 @@ use reth_db_api::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_errors::ProviderError;
use reth_evm::ConfigureEvmEnv;
use reth_primitives::{
Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId, BlockNumber, BlockNumberOrTag,
BlockWithSenders, Bytecode, Bytes, Header, Receipt, SealedBlock, SealedBlockWithSenders,
SealedHeader, StorageKey, StorageValue, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256, U256,
Account, Block, BlockHashOrNumber, BlockId, BlockNumberOrTag, 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_primitives::BlockNumber;
use reth_db_api::models::StoredBlockBodyIndices;
use reth_execution_types::{Chain, ExecutionOutcome};
use reth_primitives::{BlockNumber, SealedBlockWithSenders};
use reth_primitives::SealedBlockWithSenders;
use reth_storage_api::BlockReader;
use reth_storage_errors::provider::ProviderResult;
use reth_trie::{updates::TrieUpdates, HashedPostStateSorted};

View File

@ -1,5 +1,5 @@
use alloy_primitives::BlockNumber;
use reth_errors::ProviderResult;
use reth_primitives::BlockNumber;
/// Functionality to read the last known finalized block from the database.
pub trait FinalizedBlockReader: Send + Sync {

View File

@ -1,6 +1,7 @@
use alloy_primitives::{Address, BlockNumber, B256};
use auto_impl::auto_impl;
use reth_db_api::models::BlockNumberAddress;
use reth_primitives::{Account, Address, BlockNumber, StorageEntry, B256};
use reth_primitives::{Account, StorageEntry};
use reth_storage_errors::provider::ProviderResult;
use std::{
collections::{BTreeMap, BTreeSet, HashMap},

View File

@ -1,5 +1,6 @@
use alloy_primitives::{BlockNumber, B256};
use reth_network_p2p::headers::downloader::SyncTarget;
use reth_primitives::{BlockHashOrNumber, BlockNumber, SealedHeader, B256};
use reth_primitives::{BlockHashOrNumber, SealedHeader};
use reth_storage_errors::provider::ProviderResult;
use tokio::sync::watch;

View File

@ -1,6 +1,6 @@
use alloy_primitives::{Address, BlockNumber, B256};
use auto_impl::auto_impl;
use reth_db_api::models::BlockNumberAddress;
use reth_primitives::{Address, BlockNumber, B256};
use reth_storage_errors::provider::ProviderResult;
use std::ops::{Range, RangeInclusive};

View File

@ -1,5 +1,5 @@
use alloy_primitives::BlockNumber;
use reth_execution_types::ExecutionOutcome;
use reth_primitives::BlockNumber;
use reth_storage_errors::provider::ProviderResult;
use reth_trie::HashedPostStateSorted;
use revm::db::{

View File

@ -1,7 +1,7 @@
use std::collections::HashMap;
use alloy_primitives::B256;
use auto_impl::auto_impl;
use reth_primitives::B256;
use reth_storage_errors::provider::ProviderResult;
use reth_trie::updates::{StorageTrieUpdates, TrieUpdates};

View File

@ -1,9 +1,10 @@
use alloy_primitives::{BlockNumber, TxNumber};
use reth_db::{
cursor::{DbCursorRO, DbCursorRW},
tables,
};
use reth_errors::ProviderResult;
use reth_primitives::{BlockNumber, Receipt, TxNumber};
use reth_primitives::Receipt;
use reth_storage_api::ReceiptWriter;
pub(crate) struct DatabaseWriter<'a, W>(pub(crate) &'a mut W);

View File

@ -3,6 +3,7 @@ use crate::{
writer::static_file::StaticFileWriter,
BlockExecutionWriter, BlockWriter, HistoryWriter, StateChangeWriter, StateWriter, TrieWriter,
};
use alloy_primitives::{BlockNumber, B256, U256};
use reth_chain_state::ExecutedBlock;
use reth_db::{
cursor::DbCursorRO,
@ -12,9 +13,7 @@ use reth_db::{
};
use reth_errors::{ProviderError, ProviderResult};
use reth_execution_types::ExecutionOutcome;
use reth_primitives::{
BlockNumber, Header, SealedBlock, StaticFileSegment, TransactionSignedNoHash, B256, U256,
};
use reth_primitives::{Header, SealedBlock, StaticFileSegment, TransactionSignedNoHash};
use reth_stages_types::{StageCheckpoint, StageId};
use reth_storage_api::{
DBProvider, HeaderProvider, ReceiptWriter, StageCheckpointWriter, TransactionsProviderExt,
@ -543,15 +542,14 @@ mod tests {
use crate::{
test_utils::create_test_provider_factory, AccountReader, StorageTrieWriter, TrieWriter,
};
use alloy_primitives::{keccak256, B256, U256};
use reth_db::tables;
use reth_db_api::{
cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO},
models::{AccountBeforeTx, BlockNumberAddress},
transaction::{DbTx, DbTxMut},
};
use reth_primitives::{
keccak256, Account, Address, Receipt, Receipts, StorageEntry, B256, U256,
};
use reth_primitives::{Account, Address, Receipt, Receipts, StorageEntry};
use reth_trie::{
test_utils::{state_root, storage_root_prehashed},
HashedPostState, HashedStorage, StateRoot, StorageRoot,

View File

@ -1,6 +1,7 @@
use crate::providers::StaticFileProviderRWRefMut;
use alloy_primitives::{BlockNumber, TxNumber};
use reth_errors::ProviderResult;
use reth_primitives::{BlockNumber, Receipt, TxNumber};
use reth_primitives::Receipt;
use reth_storage_api::ReceiptWriter;
pub(crate) struct StaticFileWriter<'a, W>(pub(crate) &'a mut W);

View File

@ -2,12 +2,10 @@ use super::{
AccountReader, BlockHashReader, BlockIdReader, StateProofProvider, StateRootProvider,
StorageRootProvider,
};
use alloy_primitives::{Address, BlockHash, BlockNumber, B256, U256};
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, StorageKey, StorageValue, KECCAK_EMPTY,
};
use reth_primitives::{BlockId, BlockNumHash, BlockNumberOrTag, Bytecode, KECCAK_EMPTY};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
/// Type alias of boxed [`StateProvider`].