mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
chore: implement traits directly for futures::Either (#8172)
This commit is contained in:
@ -434,7 +434,7 @@ mod tests {
|
||||
use assert_matches::assert_matches;
|
||||
use futures::poll;
|
||||
use reth_db::{mdbx::DatabaseEnv, test_utils::TempDatabase};
|
||||
use reth_interfaces::{p2p::either::EitherDownloader, test_utils::TestFullBlockClient};
|
||||
use reth_interfaces::{p2p::either::Either, test_utils::TestFullBlockClient};
|
||||
use reth_primitives::{
|
||||
constants::ETHEREUM_BLOCK_GAS_LIMIT, stage::StageCheckpoint, BlockBody, ChainSpecBuilder,
|
||||
Header, PruneModes, SealedHeader, MAINNET,
|
||||
@ -543,15 +543,15 @@ mod tests {
|
||||
self,
|
||||
pipeline: Pipeline<DB>,
|
||||
chain_spec: Arc<ChainSpec>,
|
||||
) -> EngineSyncController<DB, EitherDownloader<Client, TestFullBlockClient>>
|
||||
) -> EngineSyncController<DB, Either<Client, TestFullBlockClient>>
|
||||
where
|
||||
DB: Database + 'static,
|
||||
Client: HeadersClient + BodiesClient + Clone + Unpin + 'static,
|
||||
{
|
||||
let client = self
|
||||
.client
|
||||
.map(EitherDownloader::Left)
|
||||
.unwrap_or_else(|| EitherDownloader::Right(TestFullBlockClient::default()));
|
||||
.map(Either::Left)
|
||||
.unwrap_or_else(|| Either::Right(TestFullBlockClient::default()));
|
||||
|
||||
EngineSyncController::new(
|
||||
pipeline,
|
||||
|
||||
@ -17,7 +17,7 @@ use reth_ethereum_engine_primitives::EthEngineTypes;
|
||||
use reth_evm::{either::Either, test_utils::MockExecutorProvider};
|
||||
use reth_evm_ethereum::execute::EthExecutorProvider;
|
||||
use reth_interfaces::{
|
||||
p2p::{bodies::client::BodiesClient, either::EitherDownloader, headers::client::HeadersClient},
|
||||
p2p::{bodies::client::BodiesClient, headers::client::HeadersClient},
|
||||
sync::NoopSyncStateUpdater,
|
||||
test_utils::NoopFullBlockClient,
|
||||
};
|
||||
@ -42,7 +42,7 @@ type DatabaseEnv = TempDatabase<DE>;
|
||||
type TestBeaconConsensusEngine<Client> = BeaconConsensusEngine<
|
||||
Arc<DatabaseEnv>,
|
||||
BlockchainProvider<Arc<DatabaseEnv>>,
|
||||
Arc<EitherDownloader<Client, NoopFullBlockClient>>,
|
||||
Arc<Either<Client, NoopFullBlockClient>>,
|
||||
EthEngineTypes,
|
||||
>;
|
||||
|
||||
@ -111,7 +111,7 @@ impl<DB> TestEnv<DB> {
|
||||
}
|
||||
|
||||
// TODO: add with_consensus in case we want to use the TestConsensus purposeful failure - this
|
||||
// would require similar patterns to how we use with_client and the EitherDownloader
|
||||
// would require similar patterns to how we use with_client and the downloader
|
||||
/// Represents either a real consensus engine, or a test consensus engine.
|
||||
#[derive(Debug, Default)]
|
||||
enum TestConsensusConfig {
|
||||
@ -331,8 +331,8 @@ where
|
||||
// use either noop client or a user provided client (for example TestFullBlockClient)
|
||||
let client = Arc::new(
|
||||
self.client
|
||||
.map(EitherDownloader::Left)
|
||||
.unwrap_or_else(|| EitherDownloader::Right(NoopFullBlockClient::default())),
|
||||
.map(Either::Left)
|
||||
.unwrap_or_else(|| Either::Right(NoopFullBlockClient::default())),
|
||||
);
|
||||
|
||||
// use either test executor or real executor
|
||||
|
||||
Reference in New Issue
Block a user