chore(reth-beacon-consensus): Replace HeadersClient + BodiesClient with BlockClient (#10066)

Co-authored-by: Skanda Bhat <bhat.skanda.m@gmail.com>
This commit is contained in:
nk_ysg
2024-08-05 01:39:12 +08:00
committed by GitHub
parent 83ac7b5ddb
commit 673e9181ee
3 changed files with 9 additions and 16 deletions

View File

@@ -8,8 +8,6 @@ use reth_db_api::database::Database;
use reth_engine_primitives::EngineTypes;
use reth_errors::{BlockValidationError, ProviderResult, RethError, RethResult};
use reth_network_p2p::{
bodies::client::BodiesClient,
headers::client::HeadersClient,
sync::{NetworkSyncUpdater, SyncState},
BlockClient,
};
@@ -235,7 +233,7 @@ where
+ StageCheckpointReader
+ ChainSpecProvider
+ 'static,
Client: HeadersClient + BodiesClient + Clone + Unpin + 'static,
Client: BlockClient + 'static,
EngineT: EngineTypes + Unpin,
{
/// Create a new instance of the [`BeaconConsensusEngine`].
@@ -1793,7 +1791,7 @@ where
impl<DB, BT, Client, EngineT> Future for BeaconConsensusEngine<DB, BT, Client, EngineT>
where
DB: Database + Unpin + 'static,
Client: HeadersClient + BodiesClient + Clone + Unpin + 'static,
Client: BlockClient + 'static,
BT: BlockchainTreeEngine
+ BlockReader
+ BlockIdReader

View File

@@ -8,9 +8,7 @@ use futures::FutureExt;
use reth_chainspec::ChainSpec;
use reth_db_api::database::Database;
use reth_network_p2p::{
bodies::client::BodiesClient,
full_block::{FetchFullBlockFuture, FetchFullBlockRangeFuture, FullBlockClient},
headers::client::HeadersClient,
BlockClient,
};
use reth_primitives::{BlockNumber, SealedBlock, B256};
@@ -66,7 +64,7 @@ where
impl<DB, Client> EngineSyncController<DB, Client>
where
DB: Database + 'static,
Client: HeadersClient + BodiesClient + Clone + Unpin + 'static,
Client: BlockClient + 'static,
{
/// Create a new instance
pub(crate) fn new(
@@ -524,7 +522,7 @@ mod tests {
) -> EngineSyncController<DB, Either<Client, TestFullBlockClient>>
where
DB: Database + 'static,
Client: HeadersClient + BodiesClient + Clone + Unpin + 'static,
Client: BlockClient + 'static,
{
let client = self
.client

View File

@@ -18,10 +18,7 @@ use reth_ethereum_engine_primitives::EthEngineTypes;
use reth_evm::{either::Either, test_utils::MockExecutorProvider};
use reth_evm_ethereum::execute::EthExecutorProvider;
use reth_exex_types::FinishedExExHeight;
use reth_network_p2p::{
bodies::client::BodiesClient, headers::client::HeadersClient, sync::NoopSyncStateUpdater,
test_utils::NoopFullBlockClient,
};
use reth_network_p2p::{sync::NoopSyncStateUpdater, test_utils::NoopFullBlockClient, BlockClient};
use reth_payload_builder::test_utils::spawn_test_payload_service;
use reth_primitives::{BlockNumber, B256};
use reth_provider::{
@@ -232,7 +229,7 @@ impl TestConsensusEngineBuilder {
client: Client,
) -> NetworkedTestConsensusEngineBuilder<Client>
where
Client: HeadersClient + BodiesClient + 'static,
Client: BlockClient + 'static,
{
NetworkedTestConsensusEngineBuilder { base_config: self, client: Some(client) }
}
@@ -259,7 +256,7 @@ pub struct NetworkedTestConsensusEngineBuilder<Client> {
impl<Client> NetworkedTestConsensusEngineBuilder<Client>
where
Client: HeadersClient + BodiesClient + 'static,
Client: BlockClient + 'static,
{
/// Set the pipeline execution outputs to use for the test consensus engine.
#[allow(dead_code)]
@@ -314,7 +311,7 @@ where
client: ClientType,
) -> NetworkedTestConsensusEngineBuilder<ClientType>
where
ClientType: HeadersClient + BodiesClient + 'static,
ClientType: BlockClient + 'static,
{
NetworkedTestConsensusEngineBuilder { base_config: self.base_config, client: Some(client) }
}
@@ -442,7 +439,7 @@ pub fn spawn_consensus_engine<Client>(
engine: TestBeaconConsensusEngine<Client>,
) -> oneshot::Receiver<Result<(), BeaconConsensusEngineError>>
where
Client: HeadersClient + BodiesClient + 'static,
Client: BlockClient + 'static,
{
let (tx, rx) = oneshot::channel();
tokio::spawn(async move {