chore(deps): use error imports directly (#8388)

This commit is contained in:
Matthias Seitz
2024-05-25 12:01:29 +02:00
committed by GitHub
parent 46fd454d80
commit 0056f2f097
37 changed files with 52 additions and 48 deletions

2
Cargo.lock generated
View File

@@ -7621,11 +7621,13 @@ dependencies = [
"reth-codecs",
"reth-db",
"reth-evm",
"reth-execution-errors",
"reth-fs-util",
"reth-interfaces",
"reth-metrics",
"reth-nippy-jar",
"reth-primitives",
"reth-storage-errors",
"reth-trie",
"revm",
"strum",

View File

@@ -13,8 +13,10 @@ workspace = true
[dependencies]
# reth
reth-execution-errors.workspace = true
reth-primitives.workspace = true
reth-fs-util.workspace = true
reth-storage-errors.workspace = true
reth-interfaces.workspace = true
reth-db.workspace = true
reth-trie = { workspace = true, features = ["metrics"] }

View File

@@ -8,13 +8,13 @@ use reth_db::{
transaction::{DbTx, DbTxMut},
};
use reth_evm::execute::BatchBlockExecutionOutput;
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{
logs_bloom,
revm::compat::{into_reth_acc, into_revm_acc},
Account, Address, BlockHash, BlockNumber, Bloom, Bytecode, Log, Receipt, Receipts,
StaticFileSegment, StorageEntry, B256, U256,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use reth_trie::HashedPostState;
pub use revm::db::states::OriginalValuesKnown;
use revm::{

View File

@@ -4,8 +4,8 @@ use reth_db::{
tables,
transaction::{DbTx, DbTxMut},
};
use reth_interfaces::db::DatabaseError;
use reth_primitives::{revm::compat::into_reth_acc, Bytecode, StorageEntry, U256};
use reth_storage_errors::db::DatabaseError;
use revm::db::states::{PlainStorageChangeset, StateChangeset};
/// A change to the state of the world.

View File

@@ -5,8 +5,8 @@ use reth_db::{
tables,
transaction::{DbTx, DbTxMut},
};
use reth_interfaces::db::DatabaseError;
use reth_primitives::{revm::compat::into_reth_acc, BlockNumber, StorageEntry, B256, U256};
use reth_storage_errors::db::DatabaseError;
use revm::db::states::{PlainStateReverts, PlainStorageRevert, RevertToSlot};
use std::iter::Peekable;

View File

@@ -1,7 +1,7 @@
//! Contains [Chain], a chain of blocks and their final state.
use crate::bundle_state::BundleStateWithReceipts;
use reth_interfaces::{executor::BlockExecutionError, RethResult};
use reth_execution_errors::BlockExecutionError;
use reth_primitives::{
Address, BlockHash, BlockNumHash, BlockNumber, ForkBlock, Receipt, SealedBlock,
SealedBlockWithSenders, SealedHeader, TransactionSigned, TransactionSignedEcRecovered, TxHash,
@@ -235,15 +235,14 @@ impl Chain {
/// Merge two chains by appending the given chain into the current one.
///
/// The state of accounts for this chain is set to the state of the newest chain.
pub fn append_chain(&mut self, other: Chain) -> RethResult<()> {
pub fn append_chain(&mut self, other: Chain) -> Result<(), BlockExecutionError> {
let chain_tip = self.tip();
let other_fork_block = other.fork_block();
if chain_tip.hash() != other_fork_block.hash {
return Err(BlockExecutionError::AppendChainDoesntConnect {
chain_tip: Box::new(chain_tip.num_hash()),
other_chain_fork: Box::new(other_fork_block),
}
.into())
})
}
// Insert blocks from other chain

View File

@@ -29,7 +29,7 @@ pub use providers::{
pub mod test_utils;
/// Re-export provider error.
pub use reth_interfaces::provider::ProviderError;
pub use reth_storage_errors::provider::ProviderError;
pub mod chain;
pub use chain::{Chain, DisplayBlocksChain};

View File

@@ -1,8 +1,8 @@
use crate::{
AccountReader, BlockHashReader, BundleStateDataProvider, StateProvider, StateRootProvider,
};
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{trie::AccountProof, Account, Address, BlockNumber, Bytecode, B256};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use reth_trie::updates::TrieUpdates;
use revm::db::BundleState;

View File

@@ -1,10 +1,10 @@
use crate::{BlockNumReader, DatabaseProviderFactory, DatabaseProviderRO, HeaderProvider};
use reth_db::database::Database;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{GotExpected, B256};
use reth_storage_errors::provider::ProviderResult;
use std::marker::PhantomData;
pub use reth_interfaces::provider::ConsistentViewError;
pub use reth_storage_errors::provider::ConsistentViewError;
/// A consistent view over state in the database.
///

View File

@@ -9,7 +9,7 @@ use crate::{
};
use reth_db::{database::Database, init_db, models::StoredBlockBodyIndices, DatabaseEnv};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::{provider::ProviderResult, RethError, RethResult};
use reth_interfaces::{RethError, RethResult};
use reth_primitives::{
stage::{StageCheckpoint, StageId},
Address, Block, BlockHash, BlockHashOrNumber, BlockNumber, BlockWithSenders, ChainInfo,
@@ -30,6 +30,7 @@ mod provider;
pub use provider::{DatabaseProvider, DatabaseProviderRO, DatabaseProviderRW};
use reth_db::mdbx::DatabaseArguments;
use reth_storage_errors::provider::ProviderResult;
/// A common provider that fetches data from a database or static file.
///
@@ -583,7 +584,6 @@ mod tests {
test_utils::{create_test_static_files_dir, ERROR_TEMPDIR},
};
use reth_interfaces::{
provider::ProviderError,
test_utils::{
generators,
generators::{random_block, random_header},
@@ -594,6 +594,7 @@ mod tests {
hex_literal::hex, ChainSpecBuilder, PruneMode, PruneModes, SealedBlock, StaticFileSegment,
TxNumber, B256, U256,
};
use reth_storage_errors::provider::ProviderError;
use std::{ops::RangeInclusive, sync::Arc};
use tokio::sync::watch;

View File

@@ -10,11 +10,11 @@ use reth_db::{
transaction::DbTx,
BlockNumberList,
};
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{
constants::EPOCH_SLOTS, trie::AccountProof, Account, Address, BlockNumber, Bytecode,
StaticFileSegment, StorageKey, StorageValue, B256,
};
use reth_storage_errors::provider::ProviderResult;
use reth_trie::{updates::TrieUpdates, HashedPostState};
use revm::db::BundleState;
use std::fmt::Debug;
@@ -413,8 +413,8 @@ mod tests {
transaction::{DbTx, DbTxMut},
BlockNumberList,
};
use reth_interfaces::provider::ProviderError;
use reth_primitives::{address, b256, Account, Address, StorageEntry, B256, U256};
use reth_storage_errors::provider::ProviderError;
const ADDRESS: Address = address!("0000000000000000000000000000000000000001");
const HIGHER_ADDRESS: Address = address!("0000000000000000000000000000000000000005");

View File

@@ -7,11 +7,11 @@ use reth_db::{
tables,
transaction::DbTx,
};
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{
trie::AccountProof, Account, Address, BlockNumber, Bytecode, StaticFileSegment, StorageKey,
StorageValue, B256,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use reth_trie::{proof::Proof, updates::TrieUpdates, HashedPostState};
use revm::db::BundleState;

View File

@@ -31,20 +31,20 @@ macro_rules! delegate_provider_impls {
$crate::providers::state::macros::delegate_impls_to_as_ref!(
for $target =>
StateRootProvider $(where [$($generics)*])? {
fn state_root(&self, state: &revm::db::BundleState) -> reth_interfaces::provider::ProviderResult<reth_primitives::B256>;
fn state_root_with_updates(&self, state: &revm::db::BundleState) -> reth_interfaces::provider::ProviderResult<(reth_primitives::B256, reth_trie::updates::TrieUpdates)>;
fn state_root(&self, state: &revm::db::BundleState) -> reth_storage_errors::provider::ProviderResult<reth_primitives::B256>;
fn state_root_with_updates(&self, state: &revm::db::BundleState) -> reth_storage_errors::provider::ProviderResult<(reth_primitives::B256, reth_trie::updates::TrieUpdates)>;
}
AccountReader $(where [$($generics)*])? {
fn basic_account(&self, address: reth_primitives::Address) -> reth_interfaces::provider::ProviderResult<Option<reth_primitives::Account>>;
fn basic_account(&self, address: reth_primitives::Address) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::Account>>;
}
BlockHashReader $(where [$($generics)*])? {
fn block_hash(&self, number: u64) -> reth_interfaces::provider::ProviderResult<Option<reth_primitives::B256>>;
fn canonical_hashes_range(&self, start: reth_primitives::BlockNumber, end: reth_primitives::BlockNumber) -> reth_interfaces::provider::ProviderResult<Vec<reth_primitives::B256>>;
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>>;
}
StateProvider $(where [$($generics)*])?{
fn storage(&self, account: reth_primitives::Address, storage_key: reth_primitives::StorageKey) -> reth_interfaces::provider::ProviderResult<Option<reth_primitives::StorageValue>>;
fn proof(&self, address: reth_primitives::Address, keys: &[reth_primitives::B256]) -> reth_interfaces::provider::ProviderResult<reth_primitives::trie::AccountProof>;
fn bytecode_by_hash(&self, code_hash: reth_primitives::B256) -> reth_interfaces::provider::ProviderResult<Option<reth_primitives::Bytecode>>;
fn storage(&self, account: reth_primitives::Address, storage_key: reth_primitives::StorageKey) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::StorageValue>>;
fn proof(&self, address: reth_primitives::Address, keys: &[reth_primitives::B256]) -> reth_storage_errors::provider::ProviderResult<reth_primitives::trie::AccountProof>;
fn bytecode_by_hash(&self, code_hash: reth_primitives::B256) -> reth_storage_errors::provider::ProviderResult<Option<reth_primitives::Bytecode>>;
}
);
}

View File

@@ -10,11 +10,11 @@ use reth_db::{
codecs::CompactU256,
static_file::{HeaderMask, ReceiptMask, StaticFileCursor, TransactionMask},
};
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{
Address, BlockHash, BlockHashOrNumber, BlockNumber, ChainInfo, Header, Receipt, SealedHeader,
TransactionMeta, TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, B256, U256,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{
ops::{Deref, RangeBounds},
sync::Arc,

View File

@@ -16,7 +16,6 @@ use reth_db::{
table::Table,
tables,
};
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_nippy_jar::NippyJar;
use reth_primitives::{
keccak256,
@@ -26,6 +25,7 @@ use reth_primitives::{
TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256,
U256,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{
collections::{hash_map::Entry, BTreeMap, HashMap},
ops::{Deref, Range, RangeBounds, RangeInclusive},

View File

@@ -9,9 +9,9 @@ pub use writer::{StaticFileProviderRW, StaticFileProviderRWRefMut};
mod metrics;
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_nippy_jar::NippyJar;
use reth_primitives::{static_file::SegmentHeader, StaticFileSegment};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{ops::Deref, sync::Arc};
const BLOCKS_PER_STATIC_FILE: u64 = 500_000;

View File

@@ -6,13 +6,13 @@ use super::{
use dashmap::mapref::one::RefMut;
use reth_codecs::Compact;
use reth_db::codecs::CompactU256;
use reth_interfaces::provider::{ProviderError, ProviderResult};
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,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::{
path::{Path, PathBuf},
sync::{Arc, Weak},

View File

@@ -8,7 +8,6 @@ use crate::{
use parking_lot::Mutex;
use reth_db::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{
keccak256, trie::AccountProof, Account, Address, Block, BlockHash, BlockHashOrNumber, BlockId,
BlockNumber, BlockWithSenders, Bytecode, Bytes, ChainInfo, ChainSpec, Header, Receipt,
@@ -16,6 +15,7 @@ use reth_primitives::{
TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256,
U256,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use reth_trie::updates::TrieUpdates;
use revm::{
db::BundleState,

View File

@@ -8,7 +8,6 @@ use crate::{
};
use reth_db::models::{AccountBeforeTx, StoredBlockBodyIndices};
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{
stage::{StageCheckpoint, StageId},
trie::AccountProof,
@@ -18,6 +17,7 @@ use reth_primitives::{
TransactionSigned, TransactionSignedNoHash, TxHash, TxNumber, Withdrawal, Withdrawals, B256,
MAINNET, U256,
};
use reth_storage_errors::provider::ProviderResult;
use reth_trie::updates::TrieUpdates;
use revm::{
db::BundleState,

View File

@@ -1,7 +1,7 @@
use auto_impl::auto_impl;
use reth_db::models::AccountBeforeTx;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{Account, Address, BlockNumber};
use reth_storage_errors::provider::ProviderResult;
use std::{
collections::{BTreeMap, BTreeSet},
ops::{RangeBounds, RangeInclusive},

View File

@@ -4,11 +4,11 @@ use crate::{
};
use auto_impl::auto_impl;
use reth_db::models::StoredBlockBodyIndices;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{
Block, BlockHashOrNumber, BlockId, BlockNumber, BlockNumberOrTag, BlockWithSenders, Header,
PruneModes, Receipt, SealedBlock, SealedBlockWithSenders, SealedHeader, B256,
};
use reth_storage_errors::provider::ProviderResult;
use reth_trie::{updates::TrieUpdates, HashedPostState};
use std::ops::RangeInclusive;

View File

@@ -1,6 +1,6 @@
use auto_impl::auto_impl;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{BlockHashOrNumber, BlockNumber, B256};
use reth_storage_errors::provider::ProviderResult;
/// Client trait for fetching block hashes by number.
#[auto_impl(&, Arc, Box)]

View File

@@ -1,6 +1,6 @@
use super::BlockHashReader;
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{BlockHashOrNumber, BlockId, BlockNumber, BlockNumberOrTag, ChainInfo, B256};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
/// Client trait for getting important block numbers (such as the latest block number), converting
/// block hashes to numbers, and fetching a block hash from its block number.

View File

@@ -1,6 +1,6 @@
use crate::DatabaseProviderRO;
use reth_db::database::Database;
use reth_interfaces::provider::ProviderResult;
use reth_storage_errors::provider::ProviderResult;
/// Database provider factory.
pub trait DatabaseProviderFactory<DB: Database> {

View File

@@ -1,6 +1,6 @@
use reth_evm::ConfigureEvmEnv;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{BlockHashOrNumber, Header};
use reth_storage_errors::provider::ProviderResult;
use revm::primitives::{BlockEnv, CfgEnv, CfgEnvWithHandlerCfg, SpecId};
/// A provider type that knows chain specific information required to configure an

View File

@@ -1,7 +1,7 @@
use auto_impl::auto_impl;
use reth_db::models::BlockNumberAddress;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{Account, Address, BlockNumber, StorageEntry, B256};
use reth_storage_errors::provider::ProviderResult;
use std::{
collections::{BTreeMap, BTreeSet, HashMap},
ops::{Range, RangeInclusive},

View File

@@ -1,6 +1,6 @@
use auto_impl::auto_impl;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{BlockHash, BlockHashOrNumber, BlockNumber, Header, SealedHeader, U256};
use reth_storage_errors::provider::ProviderResult;
use std::ops::RangeBounds;
/// Client trait for fetching `Header` related data.

View File

@@ -1,7 +1,7 @@
use auto_impl::auto_impl;
use reth_db::models::BlockNumberAddress;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{Address, BlockNumber, B256};
use reth_storage_errors::provider::ProviderResult;
use std::{
collections::BTreeMap,
ops::{Range, RangeInclusive},

View File

@@ -1,5 +1,5 @@
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{PruneCheckpoint, PruneSegment};
use reth_storage_errors::provider::ProviderResult;
/// The trait for fetching prune checkpoint related data.
#[auto_impl::auto_impl(&, Arc)]

View File

@@ -1,7 +1,7 @@
use std::ops::RangeBounds;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{BlockHashOrNumber, BlockId, BlockNumberOrTag, Receipt, TxHash, TxNumber};
use reth_storage_errors::provider::ProviderResult;
use crate::BlockIdReader;

View File

@@ -1,8 +1,8 @@
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{
stage::{StageCheckpoint, StageId},
BlockNumber,
};
use reth_storage_errors::provider::ProviderResult;
/// The trait for fetching stage checkpoint related data.
#[auto_impl::auto_impl(&, Arc)]

View File

@@ -5,11 +5,11 @@ use crate::{
};
use auto_impl::auto_impl;
use reth_db::transaction::{DbTx, DbTxMut};
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{
trie::AccountProof, Address, BlockHash, BlockId, BlockNumHash, BlockNumber, BlockNumberOrTag,
Bytecode, StorageKey, StorageValue, B256, KECCAK_EMPTY, U256,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use revm::db::OriginalValuesKnown;
/// Type alias of boxed [StateProvider].

View File

@@ -1,5 +1,5 @@
use reth_db::table::Table;
use reth_interfaces::provider::ProviderResult;
use reth_storage_errors::provider::ProviderResult;
/// The trait for fetching provider statistics.
#[auto_impl::auto_impl(&, Arc)]

View File

@@ -4,8 +4,8 @@ use std::{
};
use auto_impl::auto_impl;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{Address, BlockNumber, StorageEntry, B256};
use reth_storage_errors::provider::ProviderResult;
/// Storage reader
#[auto_impl(&, Arc, Box)]

View File

@@ -1,9 +1,9 @@
use crate::{BlockNumReader, BlockReader};
use reth_interfaces::provider::{ProviderError, ProviderResult};
use reth_primitives::{
Address, BlockHashOrNumber, BlockNumber, TransactionMeta, TransactionSigned,
TransactionSignedNoHash, TxHash, TxNumber,
};
use reth_storage_errors::provider::{ProviderError, ProviderResult};
use std::ops::{Range, RangeBounds, RangeInclusive};
/// Client trait for fetching [TransactionSigned] related data.

View File

@@ -1,6 +1,6 @@
use auto_impl::auto_impl;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::B256;
use reth_storage_errors::provider::ProviderResult;
use reth_trie::updates::TrieUpdates;
use revm::db::BundleState;

View File

@@ -1,5 +1,5 @@
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{BlockHashOrNumber, Withdrawal, Withdrawals};
use reth_storage_errors::provider::ProviderResult;
/// Client trait for fetching [Withdrawal] related data.
#[auto_impl::auto_impl(&, Arc)]