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 772d000d5e
commit c1f44c2c24
12 changed files with 372 additions and 541 deletions
+8 -7
View File
@@ -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,