mirror of
https://github.com/pezkuwichain/pezkuwi-runtime-templates.git
synced 2026-04-30 23:17:55 +00:00
+34
-5
@@ -13,6 +13,8 @@ use cumulus_client_service::{
|
||||
build_network, build_relay_chain_interface, prepare_node_config, start_relay_chain_tasks,
|
||||
BuildNetworkParams, CollatorSybilResistance, DARecoveryProfile, StartRelayChainTasksParams,
|
||||
};
|
||||
#[cfg(feature = "async-backing")]
|
||||
use cumulus_primitives_core::relay_chain::ValidationCode;
|
||||
use cumulus_primitives_core::{relay_chain::CollatorPair, ParaId};
|
||||
use cumulus_relay_chain_interface::{OverseerHandle, RelayChainInterface};
|
||||
// Substrate Imports
|
||||
@@ -243,7 +245,10 @@ async fn start_node_impl(
|
||||
task_manager: &mut task_manager,
|
||||
config: parachain_config,
|
||||
keystore: params.keystore_container.keystore(),
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
backend,
|
||||
#[cfg(feature = "async-backing")]
|
||||
backend: backend.clone(),
|
||||
network: network.clone(),
|
||||
sync_service: sync_service.clone(),
|
||||
system_rpc_tx,
|
||||
@@ -309,6 +314,8 @@ async fn start_node_impl(
|
||||
if validator {
|
||||
start_consensus(
|
||||
client.clone(),
|
||||
#[cfg(feature = "async-backing")]
|
||||
backend.clone(),
|
||||
block_import,
|
||||
prometheus_registry.as_ref(),
|
||||
telemetry.as_ref().map(|t| t.handle()),
|
||||
@@ -362,6 +369,7 @@ fn build_import_queue(
|
||||
|
||||
fn start_consensus(
|
||||
client: Arc<ParachainClient>,
|
||||
#[cfg(feature = "async-backing")] backend: Arc<ParachainBackend>,
|
||||
block_import: ParachainBlockImport,
|
||||
prometheus_registry: Option<&Registry>,
|
||||
telemetry: Option<TelemetryHandle>,
|
||||
@@ -376,13 +384,13 @@ fn start_consensus(
|
||||
overseer_handle: OverseerHandle,
|
||||
announce_block: Arc<dyn Fn(Hash, Option<Vec<u8>>) + Send + Sync>,
|
||||
) -> Result<(), sc_service::Error> {
|
||||
use cumulus_client_consensus_aura::collators::basic::{
|
||||
self as basic_aura, Params as BasicAuraParams,
|
||||
};
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
use cumulus_client_consensus_aura::collators::basic::{self as basic_aura, Params};
|
||||
#[cfg(feature = "async-backing")]
|
||||
use cumulus_client_consensus_aura::collators::lookahead::{self as aura, Params};
|
||||
|
||||
// NOTE: because we use Aura here explicitly, we can use
|
||||
// `CollatorSybilResistance::Resistant` when starting the network.
|
||||
|
||||
let slot_duration = cumulus_client_consensus_aura::slot_duration(&*client)?;
|
||||
|
||||
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
|
||||
@@ -402,11 +410,20 @@ fn start_consensus(
|
||||
client.clone(),
|
||||
);
|
||||
|
||||
let params = BasicAuraParams {
|
||||
let params = Params {
|
||||
create_inherent_data_providers: move |_, ()| async move { Ok(()) },
|
||||
block_import,
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
para_client: client,
|
||||
#[cfg(feature = "async-backing")]
|
||||
para_client: client.clone(),
|
||||
#[cfg(feature = "async-backing")]
|
||||
para_backend: backend,
|
||||
relay_client: relay_chain_interface,
|
||||
#[cfg(feature = "async-backing")]
|
||||
code_hash_provider: move |block_hash| {
|
||||
client.code_at(block_hash).ok().map(ValidationCode).map(|c| c.hash())
|
||||
},
|
||||
sync_oracle,
|
||||
keystore,
|
||||
collator_key,
|
||||
@@ -417,14 +434,26 @@ fn start_consensus(
|
||||
proposer,
|
||||
collator_service,
|
||||
// Very limited proposal time.
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
authoring_duration: Duration::from_millis(500),
|
||||
#[cfg(feature = "async-backing")]
|
||||
authoring_duration: Duration::from_millis(1500),
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
collation_request_receiver: None,
|
||||
#[cfg(feature = "async-backing")]
|
||||
reinitialize: false,
|
||||
};
|
||||
|
||||
#[cfg(not(feature = "async-backing"))]
|
||||
let fut =
|
||||
basic_aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _>(
|
||||
params,
|
||||
);
|
||||
#[cfg(feature = "async-backing")]
|
||||
let fut =
|
||||
aura::run::<Block, sp_consensus_aura::sr25519::AuthorityPair, _, _, _, _, _, _, _, _, _>(
|
||||
params,
|
||||
);
|
||||
task_manager.spawn_essential_handle().spawn("aura", None, fut);
|
||||
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user