mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 19:21:13 +00:00
Network sync refactoring (part 4) (#11412)
* Remove direct dependency of `sc-network` on `sc-network-light` * Move `WarpSyncProvider` trait and surrounding data structures into `sc-network-common` * Move `WarpSyncProvider` trait and surrounding data structures into `sc-network-common` * Create `sync` module in `sc-network-common`, create `ChainSync` trait there (not used yet), move a bunch of associated data structures from `sc-network-sync` * Switch from concrete implementation to `ChainSync` trait from `sc-network-common` * Introduce `OpaqueStateRequest`/`OpaqueStateResponse` to remove generics from `StateSync` trait * Introduce `OpaqueBlockRequest`/`OpaqueBlockResponse`, make `scheme` module of `sc-network-sync` private * Surface `sc-network-sync` into `sc-service` and make `sc-network` not depend on it anymore * Remove now unnecessary dependency from `sc-network` * Replace crate links with just text since dependencies are gone now * Remove `warp_sync` re-export from `sc-network-common` * Update copyright in network-related files * Address review comments about documentation * Apply review suggestion * Rename `extra_requests` module to `metrics` Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -38,13 +38,17 @@ use sc_consensus::import_queue::ImportQueue;
|
||||
use sc_executor::RuntimeVersionOf;
|
||||
use sc_keystore::LocalKeystore;
|
||||
use sc_network::{
|
||||
block_request_handler::{self, BlockRequestHandler},
|
||||
config::{Role, SyncMode},
|
||||
light_client_requests::{self, handler::LightClientRequestHandler},
|
||||
state_request_handler::{self, StateRequestHandler},
|
||||
warp_request_handler::{self, RequestHandler as WarpSyncRequestHandler, WarpSyncProvider},
|
||||
NetworkService,
|
||||
};
|
||||
use sc_network_common::sync::warp::WarpSyncProvider;
|
||||
use sc_network_light::light_client_requests::{self, handler::LightClientRequestHandler};
|
||||
use sc_network_sync::{
|
||||
block_request_handler::{self, BlockRequestHandler},
|
||||
state_request_handler::{self, StateRequestHandler},
|
||||
warp_request_handler::{self, RequestHandler as WarpSyncRequestHandler},
|
||||
ChainSync,
|
||||
};
|
||||
use sc_rpc::{
|
||||
author::AuthorApiServer,
|
||||
chain::ChainApiServer,
|
||||
@@ -801,6 +805,7 @@ where
|
||||
}
|
||||
};
|
||||
|
||||
let max_parallel_downloads = config.network.max_parallel_downloads;
|
||||
let network_params = sc_network::config::Params {
|
||||
role: config.role.clone(),
|
||||
executor: {
|
||||
@@ -818,9 +823,20 @@ where
|
||||
network_config: config.network.clone(),
|
||||
chain: client.clone(),
|
||||
transaction_pool: transaction_pool_adapter as _,
|
||||
import_queue: Box::new(import_queue),
|
||||
protocol_id,
|
||||
block_announce_validator,
|
||||
import_queue: Box::new(import_queue),
|
||||
create_chain_sync: Box::new(
|
||||
move |sync_mode, chain, warp_sync_provider| match ChainSync::new(
|
||||
sync_mode,
|
||||
chain,
|
||||
block_announce_validator,
|
||||
max_parallel_downloads,
|
||||
warp_sync_provider,
|
||||
) {
|
||||
Ok(chain_sync) => Ok(Box::new(chain_sync)),
|
||||
Err(error) => Err(Box::new(error).into()),
|
||||
},
|
||||
),
|
||||
metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()),
|
||||
block_request_protocol_config,
|
||||
state_request_protocol_config,
|
||||
|
||||
Reference in New Issue
Block a user