Companion for paritytech/substrate#12828 (#1939)

* Companion for paritytech/substrate#12764

* Remove `async-trait`

* Companion for paritytech/substrate#12828

* carg fmt

* Update client/relay-chain-minimal-node/src/network.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* update lockfile for {"polkadot", "substrate"}

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
This commit is contained in:
Aaro Altonen
2023-03-06 20:25:56 +02:00
committed by GitHub
parent 012d4a8b71
commit f8064eee4c
12 changed files with 372 additions and 541 deletions
+266 -256
View File
File diff suppressed because it is too large Load Diff
@@ -369,11 +369,10 @@ pub fn build_inprocess_relay_chain(
hwbench,
)?;
let sync_oracle: Arc<dyn SyncOracle + Send + Sync> = Arc::new(full_node.network.clone());
let relay_chain_interface_builder = RelayChainInProcessInterfaceBuilder {
polkadot_client: full_node.client.clone(),
backend: full_node.backend.clone(),
sync_oracle,
sync_oracle: full_node.sync_service.clone(),
overseer_handle: full_node.overseer_handle.clone().ok_or(RelayChainError::GenericError(
"Overseer not running in full node.".to_string(),
))?,
@@ -56,6 +56,8 @@ pub(crate) struct CollatorOverseerGenArgs<'a> {
pub runtime_client: Arc<BlockChainRpcClient>,
/// Underlying network service implementation.
pub network_service: Arc<sc_network::NetworkService<Block, PHash>>,
/// Syncing oracle.
pub sync_oracle: Box<dyn sp_consensus::SyncOracle + Send>,
/// Underlying authority discovery service.
pub authority_discovery_service: AuthorityDiscoveryService,
/// Receiver for collation request protocol
@@ -79,6 +81,7 @@ fn build_overseer<'a>(
CollatorOverseerGenArgs {
runtime_client,
network_service,
sync_oracle,
authority_discovery_service,
collation_req_receiver,
available_data_req_receiver,
@@ -121,7 +124,7 @@ fn build_overseer<'a>(
.network_bridge_rx(NetworkBridgeRxSubsystem::new(
network_service.clone(),
authority_discovery_service.clone(),
Box::new(network_service.clone()),
sync_oracle,
network_bridge_metrics.clone(),
peer_set_protocol_names.clone(),
))
@@ -152,7 +152,7 @@ async fn new_minimal_relay_chain(
let (collation_req_receiver, available_data_req_receiver) =
build_request_response_protocol_receivers(&request_protocol_names, &mut config);
let (network, network_starter) =
let (network, network_starter, sync_oracle) =
network::build_collator_network(network::BuildCollatorNetworkParams {
config: &config,
client: relay_chain_rpc_client.clone(),
@@ -171,6 +171,7 @@ async fn new_minimal_relay_chain(
let overseer_args = CollatorOverseerGenArgs {
runtime_client: relay_chain_rpc_client.clone(),
network_service: network.clone(),
sync_oracle,
authority_discovery_service,
collation_req_receiver,
available_data_req_receiver,
@@ -17,21 +17,15 @@
use polkadot_core_primitives::{Block, Hash};
use polkadot_service::{BlockT, NumberFor};
use polkadot_node_network_protocol::PeerId;
use sc_network::{NetworkService, SyncState};
use sc_network::NetworkService;
use sc_client_api::HeaderBackend;
use sc_consensus::{BlockImportError, BlockImportStatus, JustificationSyncLink, Link};
use sc_network_common::{
config::{
NonDefaultSetConfig, NonReservedPeerMode, NotificationHandshake, ProtocolId, SetConfig,
},
protocol::role::Roles,
service::NetworkSyncForkRequest,
sync::{
message::{BlockAnnouncesHandshake, BlockRequest},
BadPeer, Metrics, OnBlockData, PollBlockAnnounceValidation, SyncStatus,
},
sync::message::BlockAnnouncesHandshake,
};
use sc_service::{error::Error, Configuration, NetworkStarter, SpawnTaskHandle};
@@ -53,12 +47,14 @@ pub(crate) struct BuildCollatorNetworkParams<'a> {
/// Build the network service, the network status sinks and an RPC sender.
pub(crate) fn build_collator_network(
params: BuildCollatorNetworkParams,
) -> Result<(Arc<NetworkService<Block, Hash>>, NetworkStarter), Error> {
) -> Result<
(Arc<NetworkService<Block, Hash>>, NetworkStarter, Box<dyn sp_consensus::SyncOracle + Send>),
Error,
> {
let BuildCollatorNetworkParams { config, client, spawn_handle, genesis_hash } = params;
let protocol_id = config.protocol_id();
let chain_sync = DummyChainSync;
let block_announce_config = chain_sync.get_block_announce_proto_config::<Block>(
let block_announce_config = get_block_announce_proto_config::<Block>(
protocol_id.clone(),
&None,
Roles::from(&config.role),
@@ -76,13 +72,11 @@ pub(crate) fn build_collator_network(
})
},
fork_id: None,
chain_sync: Box::new(chain_sync),
network_config: config.network.clone(),
chain: client.clone(),
protocol_id,
metrics_registry: config.prometheus_config.as_ref().map(|config| config.registry.clone()),
block_announce_config,
chain_sync_service: Box::new(DummyChainSyncService::<Block>(Default::default())),
request_response_protocol_configs: Vec::new(),
};
@@ -113,246 +107,56 @@ pub(crate) fn build_collator_network(
let network_starter = NetworkStarter::new(network_start_tx);
Ok((network_service, network_starter))
Ok((network_service, network_starter, Box::new(SyncOracle {})))
}
/// Empty ChainSync shell. Syncing code is not necessary for
/// the minimal node, but network currently requires it. So
/// we provide a noop implementation.
struct DummyChainSync;
struct SyncOracle;
impl DummyChainSync {
pub fn get_block_announce_proto_config<B: BlockT>(
&self,
protocol_id: ProtocolId,
fork_id: &Option<String>,
roles: Roles,
best_number: NumberFor<B>,
best_hash: B::Hash,
genesis_hash: B::Hash,
) -> NonDefaultSetConfig {
let block_announces_protocol = {
let genesis_hash = genesis_hash.as_ref();
if let Some(ref fork_id) = fork_id {
format!(
"/{}/{}/block-announces/1",
array_bytes::bytes2hex("", genesis_hash),
fork_id
)
} else {
format!("/{}/block-announces/1", array_bytes::bytes2hex("", genesis_hash))
}
};
impl sp_consensus::SyncOracle for SyncOracle {
fn is_major_syncing(&self) -> bool {
false
}
NonDefaultSetConfig {
notifications_protocol: block_announces_protocol.into(),
fallback_names: iter::once(
format!("/{}/block-announces/1", protocol_id.as_ref()).into(),
)
fn is_offline(&self) -> bool {
true
}
}
fn get_block_announce_proto_config<B: BlockT>(
protocol_id: ProtocolId,
fork_id: &Option<String>,
roles: Roles,
best_number: NumberFor<B>,
best_hash: B::Hash,
genesis_hash: B::Hash,
) -> NonDefaultSetConfig {
let block_announces_protocol = {
let genesis_hash = genesis_hash.as_ref();
if let Some(ref fork_id) = fork_id {
format!("/{}/{}/block-announces/1", array_bytes::bytes2hex("", genesis_hash), fork_id)
} else {
format!("/{}/block-announces/1", array_bytes::bytes2hex("", genesis_hash))
}
};
NonDefaultSetConfig {
notifications_protocol: block_announces_protocol.into(),
fallback_names: iter::once(format!("/{}/block-announces/1", protocol_id.as_ref()).into())
.collect(),
max_notification_size: 1024 * 1024,
handshake: Some(NotificationHandshake::new(BlockAnnouncesHandshake::<B>::build(
roles,
best_number,
best_hash,
genesis_hash,
))),
// NOTE: `set_config` will be ignored by `protocol.rs` as the block announcement
// protocol is still hardcoded into the peerset.
set_config: SetConfig {
in_peers: 0,
out_peers: 0,
reserved_nodes: Vec::new(),
non_reserved_mode: NonReservedPeerMode::Deny,
},
}
max_notification_size: 1024 * 1024,
handshake: Some(NotificationHandshake::new(BlockAnnouncesHandshake::<B>::build(
roles,
best_number,
best_hash,
genesis_hash,
))),
// NOTE: `set_config` will be ignored by `protocol.rs` as the block announcement
// protocol is still hardcoded into the peerset.
set_config: SetConfig {
in_peers: 0,
out_peers: 0,
reserved_nodes: Vec::new(),
non_reserved_mode: NonReservedPeerMode::Deny,
},
}
}
impl<B: BlockT> sc_network_common::sync::ChainSync<B> for DummyChainSync {
fn peer_info(&self, _who: &PeerId) -> Option<sc_network_common::sync::PeerInfo<B>> {
None
}
fn status(&self) -> sc_network_common::sync::SyncStatus<B> {
SyncStatus {
state: SyncState::Idle,
best_seen_block: None,
num_peers: 0,
queued_blocks: 0,
state_sync: None,
warp_sync: None,
}
}
fn num_sync_requests(&self) -> usize {
0
}
fn num_downloaded_blocks(&self) -> usize {
0
}
fn num_peers(&self) -> usize {
0
}
fn new_peer(
&mut self,
_who: PeerId,
_best_hash: <B as BlockT>::Hash,
_best_number: polkadot_service::NumberFor<B>,
) -> Result<
Option<sc_network_common::sync::message::BlockRequest<B>>,
sc_network_common::sync::BadPeer,
> {
Ok(None)
}
fn update_chain_info(
&mut self,
_best_hash: &<B as BlockT>::Hash,
_best_number: polkadot_service::NumberFor<B>,
) {
}
fn request_justification(
&mut self,
_hash: &<B as BlockT>::Hash,
_number: polkadot_service::NumberFor<B>,
) {
}
fn clear_justification_requests(&mut self) {}
fn set_sync_fork_request(
&mut self,
_peers: Vec<PeerId>,
_hash: &<B as BlockT>::Hash,
_number: polkadot_service::NumberFor<B>,
) {
}
fn on_block_data(
&mut self,
_who: &PeerId,
_request: Option<sc_network_common::sync::message::BlockRequest<B>>,
_response: sc_network_common::sync::message::BlockResponse<B>,
) -> Result<sc_network_common::sync::OnBlockData<B>, sc_network_common::sync::BadPeer> {
unimplemented!("Not supported on the RPC collator")
}
fn on_block_justification(
&mut self,
_who: PeerId,
_response: sc_network_common::sync::message::BlockResponse<B>,
) -> Result<sc_network_common::sync::OnBlockJustification<B>, sc_network_common::sync::BadPeer>
{
unimplemented!("Not supported on the RPC collator")
}
fn on_justification_import(
&mut self,
_hash: <B as BlockT>::Hash,
_number: polkadot_service::NumberFor<B>,
_success: bool,
) {
}
fn on_block_finalized(
&mut self,
_hash: &<B as BlockT>::Hash,
_number: polkadot_service::NumberFor<B>,
) {
}
fn push_block_announce_validation(
&mut self,
_who: PeerId,
_hash: <B as BlockT>::Hash,
_announce: sc_network_common::sync::message::BlockAnnounce<<B as BlockT>::Header>,
_is_best: bool,
) {
}
fn poll_block_announce_validation(
&mut self,
_cx: &mut std::task::Context,
) -> std::task::Poll<sc_network_common::sync::PollBlockAnnounceValidation<<B as BlockT>::Header>>
{
std::task::Poll::Pending
}
fn peer_disconnected(&mut self, _who: &PeerId) {}
fn metrics(&self) -> sc_network_common::sync::Metrics {
Metrics {
queued_blocks: 0,
fork_targets: 0,
justifications: sc_network_common::sync::metrics::Metrics {
pending_requests: 0,
active_requests: 0,
importing_requests: 0,
failed_requests: 0,
},
}
}
fn block_response_into_blocks(
&self,
_request: &sc_network_common::sync::message::BlockRequest<B>,
_response: sc_network_common::sync::OpaqueBlockResponse,
) -> Result<Vec<sc_network_common::sync::message::BlockData<B>>, String> {
unimplemented!("Not supported on the RPC collator")
}
fn poll(
&mut self,
_cx: &mut std::task::Context,
) -> std::task::Poll<PollBlockAnnounceValidation<B::Header>> {
std::task::Poll::Pending
}
fn send_block_request(&mut self, _who: PeerId, _request: BlockRequest<B>) {
unimplemented!("Not supported on the RPC collator")
}
fn num_active_peers(&self) -> usize {
0
}
fn process_block_response_data(&mut self, _blocks_to_import: Result<OnBlockData<B>, BadPeer>) {}
}
struct DummyChainSyncService<B>(std::marker::PhantomData<B>);
impl<B: BlockT> NetworkSyncForkRequest<B::Hash, NumberFor<B>> for DummyChainSyncService<B> {
fn set_sync_fork_request(&self, _peers: Vec<PeerId>, _hash: B::Hash, _number: NumberFor<B>) {}
}
impl<B: BlockT> JustificationSyncLink<B> for DummyChainSyncService<B> {
fn request_justification(&self, _hash: &B::Hash, _number: NumberFor<B>) {}
fn clear_justification_requests(&self) {}
}
impl<B: BlockT> Link<B> for DummyChainSyncService<B> {
fn blocks_processed(
&mut self,
_imported: usize,
_count: usize,
_results: Vec<(Result<BlockImportStatus<NumberFor<B>>, BlockImportError>, B::Hash)>,
) {
}
fn justification_imported(
&mut self,
_who: PeerId,
_hash: &B::Hash,
_number: NumberFor<B>,
_success: bool,
) {
}
fn request_justification(&mut self, _hash: &B::Hash, _number: NumberFor<B>) {}
}
+3 -1
View File
@@ -17,6 +17,8 @@ sc-service = { git = "https://github.com/paritytech/substrate", branch = "master
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-utils = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-transactions = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -38,4 +40,4 @@ cumulus-client-network = { path = "../network" }
cumulus-primitives-core = { path = "../../primitives/core" }
cumulus-relay-chain-interface = { path = "../relay-chain-interface" }
cumulus-relay-chain-inprocess-interface = { path = "../relay-chain-inprocess-interface" }
cumulus-relay-chain-minimal-node = { path = "../relay-chain-minimal-node" }
cumulus-relay-chain-minimal-node = { path = "../relay-chain-minimal-node" }
+8 -2
View File
@@ -34,8 +34,13 @@ use polkadot_primitives::{CollatorPair, OccupiedCoreAssumption};
use sc_client_api::{
Backend as BackendT, BlockBackend, BlockchainEvents, Finalizer, ProofProvider, UsageProvider,
};
use sc_consensus::{import_queue::ImportQueueService, BlockImport, ImportQueue};
use sc_network::{config::SyncMode, NetworkService};
use sc_consensus::{
import_queue::{ImportQueue, ImportQueueService},
BlockImport,
};
use sc_network::NetworkService;
use sc_network_common::config::SyncMode;
use sc_network_sync::SyncingService;
use sc_network_transactions::TransactionsHandlerController;
use sc_service::{Configuration, NetworkStarter, SpawnTaskHandle, TaskManager, WarpSyncParams};
use sc_telemetry::{log, TelemetryWorkerHandle};
@@ -315,6 +320,7 @@ pub async fn build_network<'a, Block, Client, RCInterface, IQ>(
TracingUnboundedSender<sc_rpc::system::Request<Block>>,
TransactionsHandlerController<Block::Hash>,
NetworkStarter,
Arc<SyncingService<Block>>,
)>
where
Block: BlockT,
@@ -31,6 +31,7 @@ sc-consensus = { git = "https://github.com/paritytech/substrate", branch = "mast
sc-executor = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-sysinfo = { git = "https://github.com/paritytech/substrate", branch = "master" }
@@ -5,7 +5,7 @@ use std::{sync::Arc, time::Duration};
use cumulus_client_cli::CollatorOptions;
// Local Runtime Types
use parachain_template_runtime::{opaque::Block, Hash, RuntimeApi};
use parachain_template_runtime::{opaque::Block, RuntimeApi};
// Cumulus Imports
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
@@ -23,8 +23,8 @@ use cumulus_relay_chain_interface::{RelayChainError, RelayChainInterface};
use frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE;
use sc_consensus::ImportQueue;
use sc_executor::NativeElseWasmExecutor;
use sc_network::NetworkService;
use sc_network_common::service::NetworkBlock;
use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_keystore::SyncCryptoStorePtr;
@@ -173,7 +173,7 @@ async fn start_node_impl(
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
let (network, system_rpc_tx, tx_handler_controller, start_network) =
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
parachain_config: &parachain_config,
client: client.clone(),
@@ -218,6 +218,7 @@ async fn start_node_impl(
keystore: params.keystore_container.sync_keystore(),
backend,
network: network.clone(),
sync_service: sync_service.clone(),
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
@@ -245,8 +246,8 @@ async fn start_node_impl(
}
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
let sync_service = sync_service.clone();
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
};
let relay_chain_slot_duration = Duration::from_secs(6);
@@ -264,7 +265,7 @@ async fn start_node_impl(
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
network,
sync_service,
params.keystore_container.sync_keystore(),
force_authoring,
para_id,
@@ -353,7 +354,7 @@ fn build_consensus(
task_manager: &TaskManager,
relay_chain_interface: Arc<dyn RelayChainInterface>,
transaction_pool: Arc<sc_transaction_pool::FullPool<Block, ParachainClient>>,
sync_oracle: Arc<NetworkService<Block, Hash>>,
sync_oracle: Arc<SyncingService<Block>>,
keystore: SyncCryptoStorePtr,
force_authoring: bool,
para_id: ParaId,
+1
View File
@@ -53,6 +53,7 @@ sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch
sp-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-common = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network-sync = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-basic-authorship = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-timestamp = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
+20 -17
View File
@@ -43,8 +43,8 @@ use sc_consensus::{
BlockImportParams, ImportQueue,
};
use sc_executor::WasmExecutor;
use sc_network::NetworkService;
use sc_network_common::service::NetworkBlock;
use sc_network_sync::SyncingService;
use sc_service::{Configuration, PartialComponents, TFullBackend, TFullClient, TaskManager};
use sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker, TelemetryWorkerHandle};
use sp_api::{ApiExt, ConstructRuntimeApi};
@@ -359,7 +359,7 @@ where
&TaskManager,
Arc<dyn RelayChainInterface>,
Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
Arc<NetworkService<Block, Hash>>,
Arc<SyncingService<Block>>,
SyncCryptoStorePtr,
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
@@ -394,7 +394,7 @@ where
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
let (network, system_rpc_tx, tx_handler_controller, start_network) =
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
parachain_config: &parachain_config,
client: client.clone(),
@@ -418,6 +418,7 @@ where
keystore: params.keystore_container.sync_keystore(),
backend: backend.clone(),
network: network.clone(),
sync_service: sync_service.clone(),
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
@@ -440,8 +441,8 @@ where
}
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
let sync_service = sync_service.clone();
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
};
let relay_chain_slot_duration = Duration::from_secs(6);
@@ -459,7 +460,7 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
network,
sync_service,
params.keystore_container.sync_keystore(),
force_authoring,
)?;
@@ -549,7 +550,7 @@ where
&TaskManager,
Arc<dyn RelayChainInterface>,
Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
Arc<NetworkService<Block, Hash>>,
Arc<SyncingService<Block>>,
SyncCryptoStorePtr,
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
@@ -583,8 +584,8 @@ where
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
let (network, system_rpc_tx, tx_handler_controller, start_network) =
build_network(cumulus_client_service::BuildNetworkParams {
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
parachain_config: &parachain_config,
client: client.clone(),
transaction_pool: transaction_pool.clone(),
@@ -620,6 +621,7 @@ where
keystore: params.keystore_container.sync_keystore(),
backend: backend.clone(),
network: network.clone(),
sync_service: sync_service.clone(),
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
@@ -642,8 +644,8 @@ where
}
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
let sync_service = sync_service.clone();
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
};
let relay_chain_slot_duration = Duration::from_secs(6);
@@ -660,7 +662,7 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
network,
sync_service,
params.keystore_container.sync_keystore(),
force_authoring,
)?;
@@ -1321,7 +1323,7 @@ where
&TaskManager,
Arc<dyn RelayChainInterface>,
Arc<sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>>,
Arc<NetworkService<Block, Hash>>,
Arc<SyncingService<Block>>,
SyncCryptoStorePtr,
bool,
) -> Result<Box<dyn ParachainConsensus<Block>>, sc_service::Error>,
@@ -1355,7 +1357,7 @@ where
let transaction_pool = params.transaction_pool.clone();
let import_queue_service = params.import_queue.service();
let (network, system_rpc_tx, tx_handler_controller, start_network) =
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
parachain_config: &parachain_config,
client: client.clone(),
@@ -1391,6 +1393,7 @@ where
keystore: params.keystore_container.sync_keystore(),
backend: backend.clone(),
network: network.clone(),
sync_service: sync_service.clone(),
system_rpc_tx,
tx_handler_controller,
telemetry: telemetry.as_mut(),
@@ -1413,8 +1416,8 @@ where
}
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
let sync_service = sync_service.clone();
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
};
let relay_chain_slot_duration = Duration::from_secs(6);
@@ -1431,7 +1434,7 @@ where
&task_manager,
relay_chain_interface.clone(),
transaction_pool,
network,
sync_service,
params.keystore_container.sync_keystore(),
force_authoring,
)?;
+5 -5
View File
@@ -259,7 +259,7 @@ async fn build_relay_chain_interface(
Ok(Arc::new(RelayChainInProcessInterface::new(
relay_chain_full_node.client.clone(),
relay_chain_full_node.backend.clone(),
Arc::new(relay_chain_full_node.network.clone()),
relay_chain_full_node.sync_service.clone(),
relay_chain_full_node.overseer_handle.ok_or(RelayChainError::GenericError(
"Overseer should be running in full node.".to_string(),
))?,
@@ -315,8 +315,7 @@ where
})?;
let import_queue_service = params.import_queue.service();
let (network, system_rpc_tx, tx_handler_controller, start_network) =
let (network, system_rpc_tx, tx_handler_controller, start_network, sync_service) =
build_network(BuildNetworkParams {
parachain_config: &parachain_config,
client: client.clone(),
@@ -344,14 +343,15 @@ where
keystore: params.keystore_container.sync_keystore(),
backend: backend.clone(),
network: network.clone(),
sync_service: sync_service.clone(),
system_rpc_tx,
tx_handler_controller,
telemetry: None,
})?;
let announce_block = {
let network = network.clone();
Arc::new(move |hash, data| network.announce_block(hash, data))
let sync_service = sync_service.clone();
Arc::new(move |hash, data| sync_service.announce_block(hash, data))
};
let announce_block = wrap_announce_block