chore: rm reth-interfaces from stages (#8455)

This commit is contained in:
Matthias Seitz
2024-05-29 11:28:52 +02:00
committed by GitHub
parent 25e2b24257
commit 97cb383543
18 changed files with 71 additions and 68 deletions

4
Cargo.lock generated
View File

@ -8004,14 +8004,18 @@ dependencies = [
"reth-etl",
"reth-evm",
"reth-evm-ethereum",
"reth-execution-errors",
"reth-exex",
"reth-interfaces",
"reth-network-p2p",
"reth-network-types",
"reth-primitives",
"reth-provider",
"reth-revm",
"reth-stages-api",
"reth-static-file",
"reth-storage-errors",
"reth-testing-utils",
"reth-trie",
"serde_json",
"tempfile",

View File

@ -13,19 +13,22 @@ workspace = true
[dependencies]
# reth
reth-exex.workspace = true
reth-primitives.workspace = true
reth-interfaces.workspace = true
reth-db.workspace = true
reth-codecs.workspace = true
reth-provider.workspace = true
reth-trie = { workspace = true, features = ["metrics"] }
reth-etl.workspace = true
reth-config.workspace = true
reth-stages-api = { workspace = true, features = ["test-utils"] }
reth-consensus.workspace = true
reth-db.workspace = true
reth-etl.workspace = true
reth-evm.workspace = true
reth-exex.workspace = true
reth-network-p2p.workspace = true
reth-primitives.workspace = true
reth-provider.workspace = true
reth-storage-errors.workspace = true
reth-revm.workspace = true
reth-stages-api = { workspace = true, features = ["test-utils"] }
reth-trie = { workspace = true, features = ["metrics"] }
reth-testing-utils = { workspace = true, optional = true }
# async
tokio = { workspace = true, features = ["sync"] }
@ -46,11 +49,13 @@ tempfile = { workspace = true, optional = true }
reth-primitives = { workspace = true, features = ["test-utils", "arbitrary"] }
reth-db = { workspace = true, features = ["test-utils", "mdbx"] }
reth-evm-ethereum.workspace = true
reth-execution-errors.workspace = true
reth-interfaces = { workspace = true, features = ["test-utils"] }
reth-consensus = { workspace = true, features = ["test-utils"] }
reth-downloaders.workspace = true
reth-revm.workspace = true
reth-static-file.workspace = true
reth-testing-utils.workspace = true
reth-trie = { workspace = true, features = ["test-utils"] }
reth-provider = { workspace = true, features = ["test-utils"] }
reth-network-types.workspace = true
@ -78,10 +83,11 @@ pprof = { workspace = true, features = [
[features]
test-utils = [
"reth-interfaces/test-utils",
"reth-network-p2p/test-utils",
"reth-db/test-utils",
"reth-provider/test-utils",
"reth-stages-api/test-utils",
"dep:reth-testing-utils",
"dep:tempfile",
]

View File

@ -15,7 +15,7 @@
//! # use std::sync::Arc;
//! # use reth_downloaders::bodies::bodies::BodiesDownloaderBuilder;
//! # use reth_downloaders::headers::reverse_headers::ReverseHeadersDownloaderBuilder;
//! # use reth_interfaces::test_utils::{TestBodiesClient, TestHeadersClient};
//! # use reth_network_p2p::test_utils::{TestBodiesClient, TestHeadersClient};
//! # use reth_evm_ethereum::execute::EthExecutorProvider;
//! # use reth_primitives::{MAINNET, B256, PruneModes};
//! # use reth_network_types::PeerId;

View File

@ -47,9 +47,7 @@ use reth_config::config::StageConfig;
use reth_consensus::Consensus;
use reth_db::database::Database;
use reth_evm::execute::BlockExecutorProvider;
use reth_interfaces::p2p::{
bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader,
};
use reth_network_p2p::{bodies::downloader::BodyDownloader, headers::downloader::HeaderDownloader};
use reth_primitives::PruneModes;
use reth_provider::{HeaderSyncGapProvider, HeaderSyncMode};
use std::sync::Arc;

View File

@ -13,10 +13,7 @@ use reth_db::{
tables,
transaction::DbTxMut,
};
use reth_interfaces::{
p2p::bodies::{downloader::BodyDownloader, response::BlockResponse},
provider::ProviderResult,
};
use reth_network_p2p::bodies::{downloader::BodyDownloader, response::BlockResponse};
use reth_primitives::{
stage::{EntitiesCheckpoint, StageCheckpoint, StageId},
StaticFileSegment, TxNumber,
@ -28,6 +25,7 @@ use reth_provider::{
use reth_stages_api::{ExecInput, ExecOutput, StageError, UnwindInput, UnwindOutput};
use reth_stages_api::Stage;
use reth_storage_errors::provider::ProviderResult;
// TODO(onbjerg): Metrics and events (gradual status for e.g. CLI)
/// The body stage downloads block bodies.
@ -635,18 +633,12 @@ mod tests {
transaction::{DbTx, DbTxMut},
DatabaseEnv,
};
use reth_interfaces::{
p2p::{
bodies::{
downloader::{BodyDownloader, BodyDownloaderResult},
response::BlockResponse,
},
error::DownloadResult,
},
test_utils::{
generators,
generators::{random_block_range, random_signed_tx},
use reth_network_p2p::{
bodies::{
downloader::{BodyDownloader, BodyDownloaderResult},
response::BlockResponse,
},
error::DownloadResult,
};
use reth_primitives::{
BlockBody, BlockHash, BlockNumber, Header, SealedBlock, SealedHeader,
@ -657,6 +649,10 @@ mod tests {
StaticFileProviderFactory, TransactionsProvider,
};
use reth_stages_api::{ExecInput, ExecOutput, UnwindInput};
use reth_testing_utils::{
generators,
generators::{random_block_range, random_signed_tx},
};
use crate::{
stages::bodies::BodyStage,

View File

@ -655,7 +655,7 @@ mod tests {
use assert_matches::assert_matches;
use reth_db::{models::AccountBeforeTx, transaction::DbTxMut};
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_interfaces::executor::BlockValidationError;
use reth_execution_errors::BlockValidationError;
use reth_primitives::{
address, hex_literal::hex, keccak256, stage::StageUnitCheckpoint, Account, Address,
Bytecode, ChainSpecBuilder, PruneMode, ReceiptsLogPruneConfig, SealedBlock, StorageEntry,

View File

@ -40,12 +40,12 @@ mod tests {
stage_test_suite_ext, ExecuteStageTestRunner, StageTestRunner, TestRunnerError,
TestStageDB, UnwindStageTestRunner,
};
use reth_interfaces::test_utils::{
use reth_primitives::SealedHeader;
use reth_provider::providers::StaticFileWriter;
use reth_testing_utils::{
generators,
generators::{random_header, random_header_range},
};
use reth_primitives::SealedHeader;
use reth_provider::providers::StaticFileWriter;
stage_test_suite_ext!(FinishTestRunner, finish);

View File

@ -8,7 +8,6 @@ use reth_db::{
RawKey, RawTable, RawValue,
};
use reth_etl::Collector;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{
keccak256,
stage::{AccountHashingCheckpoint, EntitiesCheckpoint, StageCheckpoint, StageId},
@ -16,6 +15,7 @@ use reth_primitives::{
};
use reth_provider::{AccountExtReader, DatabaseProviderRW, HashingWriter, StatsReader};
use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput};
use reth_storage_errors::provider::ProviderResult;
use std::{
fmt::Debug,
ops::{Range, RangeInclusive},
@ -65,12 +65,12 @@ impl AccountHashingStage {
opts: SeedOpts,
) -> Result<Vec<(reth_primitives::Address, reth_primitives::Account)>, StageError> {
use reth_db::models::AccountBeforeTx;
use reth_interfaces::test_utils::{
use reth_primitives::U256;
use reth_provider::providers::StaticFileWriter;
use reth_testing_utils::{
generators,
generators::{random_block_range, random_eoa_accounts},
};
use reth_primitives::U256;
use reth_provider::providers::StaticFileWriter;
let mut rng = generators::rng();

View File

@ -10,7 +10,6 @@ use reth_db::{
transaction::{DbTx, DbTxMut},
};
use reth_etl::Collector;
use reth_interfaces::provider::ProviderResult;
use reth_primitives::{
keccak256,
stage::{EntitiesCheckpoint, StageCheckpoint, StageId, StorageHashingCheckpoint},
@ -18,6 +17,7 @@ use reth_primitives::{
};
use reth_provider::{DatabaseProviderRW, HashingWriter, StatsReader, StorageReader};
use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput};
use reth_storage_errors::provider::ProviderResult;
use std::{
fmt::Debug,
sync::mpsc::{self, Receiver},
@ -223,12 +223,12 @@ mod tests {
cursor::{DbCursorRW, DbDupCursorRO},
models::StoredBlockBodyIndices,
};
use reth_interfaces::test_utils::{
use reth_primitives::{Address, SealedBlock, U256};
use reth_provider::providers::StaticFileWriter;
use reth_testing_utils::{
generators,
generators::{random_block_range, random_contract_account_range},
};
use reth_primitives::{Address, SealedBlock, U256};
use reth_provider::providers::StaticFileWriter;
stage_test_suite_ext!(StorageHashingTestRunner, storage_hashing);

View File

@ -10,10 +10,7 @@ use reth_db::{
RawKey, RawTable, RawValue,
};
use reth_etl::Collector;
use reth_interfaces::{
p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError},
provider::ProviderError,
};
use reth_network_p2p::headers::{downloader::HeaderDownloader, error::HeadersDownloaderError};
use reth_primitives::{
stage::{
CheckpointBlockRange, EntitiesCheckpoint, HeadersCheckpoint, StageCheckpoint, StageId,
@ -28,6 +25,7 @@ use reth_provider::{
use reth_stages_api::{
BlockErrorKind, ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput,
};
use reth_storage_errors::provider::ProviderError;
use std::{
sync::Arc,
task::{ready, Context, Poll},
@ -383,13 +381,13 @@ mod tests {
stage_test_suite, ExecuteStageTestRunner, StageTestRunner, UnwindStageTestRunner,
};
use assert_matches::assert_matches;
use reth_interfaces::test_utils::generators::{self, random_header, random_header_range};
use reth_primitives::{
stage::StageUnitCheckpoint, BlockBody, SealedBlock, SealedBlockWithSenders, B256,
};
use reth_provider::{
BlockWriter, BundleStateWithReceipts, ProviderFactory, StaticFileProviderFactory,
};
use reth_testing_utils::generators::{self, random_header, random_header_range};
use reth_trie::{updates::TrieUpdates, HashedPostState};
use test_runner::HeadersTestRunner;
@ -401,7 +399,7 @@ mod tests {
use reth_downloaders::headers::reverse_headers::{
ReverseHeadersDownloader, ReverseHeadersDownloaderBuilder,
};
use reth_interfaces::test_utils::{TestHeaderDownloader, TestHeadersClient};
use reth_network_p2p::test_utils::{TestHeaderDownloader, TestHeadersClient};
use reth_provider::BlockNumReader;
use tokio::sync::watch;

View File

@ -157,12 +157,12 @@ mod tests {
transaction::DbTx,
BlockNumberList,
};
use reth_interfaces::test_utils::{
use reth_primitives::{address, BlockNumber, B256};
use reth_provider::providers::StaticFileWriter;
use reth_testing_utils::{
generators,
generators::{random_block_range, random_changeset_range, random_contract_account_range},
};
use reth_primitives::{address, BlockNumber, B256};
use reth_provider::providers::StaticFileWriter;
use std::collections::BTreeMap;
const ADDRESS: Address = address!("0000000000000000000000000000000000000001");

View File

@ -164,12 +164,12 @@ mod tests {
transaction::DbTx,
BlockNumberList,
};
use reth_interfaces::test_utils::{
use reth_primitives::{address, b256, Address, BlockNumber, StorageEntry, B256, U256};
use reth_provider::providers::StaticFileWriter;
use reth_testing_utils::{
generators,
generators::{random_block_range, random_changeset_range, random_contract_account_range},
};
use reth_primitives::{address, b256, Address, BlockNumber, StorageEntry, B256, U256};
use reth_provider::providers::StaticFileWriter;
use std::collections::BTreeMap;
const ADDRESS: Address = address!("0000000000000000000000000000000000000001");

View File

@ -368,16 +368,16 @@ mod tests {
};
use assert_matches::assert_matches;
use reth_db::cursor::{DbCursorRO, DbCursorRW, DbDupCursorRO};
use reth_interfaces::test_utils::{
use reth_primitives::{
keccak256, stage::StageUnitCheckpoint, SealedBlock, StaticFileSegment, StorageEntry, U256,
};
use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory};
use reth_testing_utils::{
generators,
generators::{
random_block, random_block_range, random_changeset_range, random_contract_account_range,
},
};
use reth_primitives::{
keccak256, stage::StageUnitCheckpoint, SealedBlock, StaticFileSegment, StorageEntry, U256,
};
use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory};
use reth_trie::test_utils::{state_root, state_root_prehashed};
use std::collections::BTreeMap;

View File

@ -52,7 +52,6 @@ mod tests {
};
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_exex::ExExManagerHandle;
use reth_interfaces::test_utils::generators::{self, random_block};
use reth_primitives::{
address, hex_literal::hex, keccak256, Account, Bytecode, ChainSpecBuilder, PruneMode,
PruneModes, SealedBlock, StaticFileSegment, U256,
@ -62,6 +61,7 @@ mod tests {
StorageReader,
};
use reth_stages_api::{ExecInput, Stage};
use reth_testing_utils::generators::{self, random_block};
use std::sync::Arc;
#[tokio::test]

View File

@ -285,10 +285,6 @@ struct FailedSenderRecoveryError {
mod tests {
use assert_matches::assert_matches;
use reth_db::cursor::DbCursorRO;
use reth_interfaces::test_utils::{
generators,
generators::{random_block, random_block_range},
};
use reth_primitives::{
stage::StageUnitCheckpoint, BlockNumber, PruneCheckpoint, PruneMode, SealedBlock,
TransactionSigned, B256,
@ -297,6 +293,10 @@ mod tests {
providers::StaticFileWriter, PruneCheckpointWriter, StaticFileProviderFactory,
TransactionsProvider,
};
use reth_testing_utils::{
generators,
generators::{random_block, random_block_range},
};
use super::*;
use crate::test_utils::{

View File

@ -8,7 +8,6 @@ use reth_db::{
RawKey, RawValue,
};
use reth_etl::Collector;
use reth_interfaces::provider::ProviderError;
use reth_primitives::{
stage::{EntitiesCheckpoint, StageCheckpoint, StageId},
PruneCheckpoint, PruneMode, PrunePurpose, PruneSegment, TxHash, TxNumber,
@ -18,6 +17,7 @@ use reth_provider::{
TransactionsProvider, TransactionsProviderExt,
};
use reth_stages_api::{ExecInput, ExecOutput, Stage, StageError, UnwindInput, UnwindOutput};
use reth_storage_errors::provider::ProviderError;
use tracing::*;
/// The transaction lookup stage.
@ -242,12 +242,12 @@ mod tests {
TestRunnerError, TestStageDB, UnwindStageTestRunner,
};
use assert_matches::assert_matches;
use reth_interfaces::test_utils::{
use reth_primitives::{stage::StageUnitCheckpoint, BlockNumber, SealedBlock, B256};
use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory};
use reth_testing_utils::{
generators,
generators::{random_block, random_block_range},
};
use reth_primitives::{stage::StageUnitCheckpoint, BlockNumber, SealedBlock, B256};
use reth_provider::{providers::StaticFileWriter, StaticFileProviderFactory};
use std::ops::Sub;
// Implement stage test suite.

View File

@ -1,10 +1,10 @@
use super::TestStageDB;
use reth_db::{test_utils::TempDatabase, DatabaseEnv};
use reth_interfaces::db::DatabaseError;
use reth_provider::ProviderError;
use reth_stages_api::{
ExecInput, ExecOutput, Stage, StageError, StageExt, UnwindInput, UnwindOutput,
};
use reth_storage_errors::db::DatabaseError;
use std::sync::Arc;
use tokio::sync::oneshot;

View File

@ -11,7 +11,6 @@ use reth_db::{
transaction::{DbTx, DbTxMut},
DatabaseEnv, DatabaseError as DbError,
};
use reth_interfaces::{provider::ProviderResult, test_utils::generators::ChangeSet};
use reth_primitives::{
keccak256, Account, Address, BlockNumber, Receipt, SealedBlock, SealedHeader,
StaticFileSegment, StorageEntry, TxHash, TxNumber, B256, MAINNET, U256,
@ -20,6 +19,8 @@ use reth_provider::{
providers::{StaticFileProviderRWRefMut, StaticFileWriter},
HistoryWriter, ProviderError, ProviderFactory, StaticFileProviderFactory,
};
use reth_storage_errors::provider::ProviderResult;
use reth_testing_utils::generators::ChangeSet;
use std::{collections::BTreeMap, path::Path, sync::Arc};
use tempfile::TempDir;