mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 07:01:03 +00:00
Single ParachainBlockImport instance (#1782)
This commit is contained in:
@@ -17,6 +17,7 @@
|
|||||||
//! Parachain specific wrapper for the AuRa import queue.
|
//! Parachain specific wrapper for the AuRa import queue.
|
||||||
|
|
||||||
use codec::Codec;
|
use codec::Codec;
|
||||||
|
use cumulus_client_consensus_common::ParachainBlockImport;
|
||||||
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
|
use sc_client_api::{backend::AuxStore, BlockOf, UsageProvider};
|
||||||
use sc_consensus::{import_queue::DefaultImportQueue, BlockImport};
|
use sc_consensus::{import_queue::DefaultImportQueue, BlockImport};
|
||||||
use sc_consensus_aura::AuraVerifier;
|
use sc_consensus_aura::AuraVerifier;
|
||||||
@@ -33,10 +34,10 @@ use sp_runtime::traits::Block as BlockT;
|
|||||||
use std::{fmt::Debug, hash::Hash, sync::Arc};
|
use std::{fmt::Debug, hash::Hash, sync::Arc};
|
||||||
use substrate_prometheus_endpoint::Registry;
|
use substrate_prometheus_endpoint::Registry;
|
||||||
|
|
||||||
/// Parameters of [`import_queue`].
|
/// Parameters for [`import_queue`].
|
||||||
pub struct ImportQueueParams<'a, I, C, CIDP, S> {
|
pub struct ImportQueueParams<'a, I, C, CIDP, S> {
|
||||||
/// The block import to use.
|
/// The block import to use.
|
||||||
pub block_import: I,
|
pub block_import: ParachainBlockImport<I>,
|
||||||
/// The client to interact with the chain.
|
/// The client to interact with the chain.
|
||||||
pub client: Arc<C>,
|
pub client: Arc<C>,
|
||||||
/// The inherent data providers, to create the inherent data.
|
/// The inherent data providers, to create the inherent data.
|
||||||
@@ -83,7 +84,7 @@ where
|
|||||||
CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync,
|
CIDP::InherentDataProviders: InherentDataProviderExt + Send + Sync,
|
||||||
{
|
{
|
||||||
sc_consensus_aura::import_queue::<P, _, _, _, _, _>(sc_consensus_aura::ImportQueueParams {
|
sc_consensus_aura::import_queue::<P, _, _, _, _, _>(sc_consensus_aura::ImportQueueParams {
|
||||||
block_import: cumulus_client_consensus_common::ParachainBlockImport::new(block_import),
|
block_import,
|
||||||
justification_import: None,
|
justification_import: None,
|
||||||
client,
|
client,
|
||||||
create_inherent_data_providers,
|
create_inherent_data_providers,
|
||||||
|
|||||||
@@ -71,6 +71,22 @@ impl<B, CIDP, W> Clone for AuraConsensus<B, CIDP, W> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Parameters of [`AuraConsensus::build`].
|
||||||
|
pub struct BuildAuraConsensusParams<PF, BI, CIDP, Client, BS, SO> {
|
||||||
|
pub proposer_factory: PF,
|
||||||
|
pub create_inherent_data_providers: CIDP,
|
||||||
|
pub block_import: ParachainBlockImport<BI>,
|
||||||
|
pub para_client: Arc<Client>,
|
||||||
|
pub backoff_authoring_blocks: Option<BS>,
|
||||||
|
pub sync_oracle: SO,
|
||||||
|
pub keystore: SyncCryptoStorePtr,
|
||||||
|
pub force_authoring: bool,
|
||||||
|
pub slot_duration: SlotDuration,
|
||||||
|
pub telemetry: Option<TelemetryHandle>,
|
||||||
|
pub block_proposal_slot_portion: SlotProportion,
|
||||||
|
pub max_block_proposal_slot_portion: Option<SlotProportion>,
|
||||||
|
}
|
||||||
|
|
||||||
impl<B, CIDP> AuraConsensus<B, CIDP, ()>
|
impl<B, CIDP> AuraConsensus<B, CIDP, ()>
|
||||||
where
|
where
|
||||||
B: BlockT,
|
B: BlockT,
|
||||||
@@ -117,7 +133,7 @@ where
|
|||||||
let worker = sc_consensus_aura::build_aura_worker::<P, _, _, _, _, _, _, _, _>(
|
let worker = sc_consensus_aura::build_aura_worker::<P, _, _, _, _, _, _, _, _>(
|
||||||
BuildAuraWorkerParams {
|
BuildAuraWorkerParams {
|
||||||
client: para_client,
|
client: para_client,
|
||||||
block_import: ParachainBlockImport::new(block_import),
|
block_import,
|
||||||
justification_sync_link: (),
|
justification_sync_link: (),
|
||||||
proposer_factory,
|
proposer_factory,
|
||||||
sync_oracle,
|
sync_oracle,
|
||||||
@@ -216,19 +232,3 @@ where
|
|||||||
Some(ParachainCandidate { block: res.block, proof: res.storage_proof })
|
Some(ParachainCandidate { block: res.block, proof: res.storage_proof })
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Parameters of [`AuraConsensus::build`].
|
|
||||||
pub struct BuildAuraConsensusParams<PF, BI, CIDP, Client, BS, SO> {
|
|
||||||
pub proposer_factory: PF,
|
|
||||||
pub create_inherent_data_providers: CIDP,
|
|
||||||
pub block_import: BI,
|
|
||||||
pub para_client: Arc<Client>,
|
|
||||||
pub backoff_authoring_blocks: Option<BS>,
|
|
||||||
pub sync_oracle: SO,
|
|
||||||
pub keystore: SyncCryptoStorePtr,
|
|
||||||
pub force_authoring: bool,
|
|
||||||
pub slot_duration: SlotDuration,
|
|
||||||
pub telemetry: Option<TelemetryHandle>,
|
|
||||||
pub block_proposal_slot_portion: SlotProportion,
|
|
||||||
pub max_block_proposal_slot_portion: Option<SlotProportion>,
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ impl<I> ParachainBlockImport<I> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl<I: Clone> Clone for ParachainBlockImport<I> {
|
||||||
|
fn clone(&self) -> Self {
|
||||||
|
ParachainBlockImport(self.0.clone())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
impl<Block, I> BlockImport<Block> for ParachainBlockImport<I>
|
impl<Block, I> BlockImport<Block> for ParachainBlockImport<I>
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
use std::{marker::PhantomData, sync::Arc};
|
use std::{marker::PhantomData, sync::Arc};
|
||||||
|
|
||||||
|
use cumulus_client_consensus_common::ParachainBlockImport;
|
||||||
|
|
||||||
use sc_consensus::{
|
use sc_consensus::{
|
||||||
import_queue::{BasicQueue, Verifier as VerifierT},
|
import_queue::{BasicQueue, Verifier as VerifierT},
|
||||||
BlockImport, BlockImportParams,
|
BlockImport, BlockImportParams,
|
||||||
@@ -103,7 +105,7 @@ where
|
|||||||
/// Start an import queue for a Cumulus collator that does not uses any special authoring logic.
|
/// Start an import queue for a Cumulus collator that does not uses any special authoring logic.
|
||||||
pub fn import_queue<Client, Block: BlockT, I, CIDP>(
|
pub fn import_queue<Client, Block: BlockT, I, CIDP>(
|
||||||
client: Arc<Client>,
|
client: Arc<Client>,
|
||||||
block_import: I,
|
block_import: ParachainBlockImport<I>,
|
||||||
create_inherent_data_providers: CIDP,
|
create_inherent_data_providers: CIDP,
|
||||||
spawner: &impl sp_core::traits::SpawnEssentialNamed,
|
spawner: &impl sp_core::traits::SpawnEssentialNamed,
|
||||||
registry: Option<&substrate_prometheus_endpoint::Registry>,
|
registry: Option<&substrate_prometheus_endpoint::Registry>,
|
||||||
@@ -117,11 +119,5 @@ where
|
|||||||
{
|
{
|
||||||
let verifier = Verifier::new(client, create_inherent_data_providers);
|
let verifier = Verifier::new(client, create_inherent_data_providers);
|
||||||
|
|
||||||
Ok(BasicQueue::new(
|
Ok(BasicQueue::new(verifier, Box::new(block_import), None, spawner, registry))
|
||||||
verifier,
|
|
||||||
Box::new(cumulus_client_consensus_common::ParachainBlockImport::new(block_import)),
|
|
||||||
None,
|
|
||||||
spawner,
|
|
||||||
registry,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,16 +90,14 @@ where
|
|||||||
para_id: ParaId,
|
para_id: ParaId,
|
||||||
proposer_factory: PF,
|
proposer_factory: PF,
|
||||||
create_inherent_data_providers: CIDP,
|
create_inherent_data_providers: CIDP,
|
||||||
block_import: BI,
|
block_import: ParachainBlockImport<BI>,
|
||||||
relay_chain_interface: RCInterface,
|
relay_chain_interface: RCInterface,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
Self {
|
Self {
|
||||||
para_id,
|
para_id,
|
||||||
proposer_factory: Arc::new(Mutex::new(proposer_factory)),
|
proposer_factory: Arc::new(Mutex::new(proposer_factory)),
|
||||||
create_inherent_data_providers: Arc::new(create_inherent_data_providers),
|
create_inherent_data_providers: Arc::new(create_inherent_data_providers),
|
||||||
block_import: Arc::new(futures::lock::Mutex::new(ParachainBlockImport::new(
|
block_import: Arc::new(futures::lock::Mutex::new(block_import)),
|
||||||
block_import,
|
|
||||||
))),
|
|
||||||
relay_chain_interface,
|
relay_chain_interface,
|
||||||
_phantom: PhantomData,
|
_phantom: PhantomData,
|
||||||
}
|
}
|
||||||
@@ -222,7 +220,7 @@ pub struct BuildRelayChainConsensusParams<PF, BI, CIDP, RCInterface> {
|
|||||||
pub para_id: ParaId,
|
pub para_id: ParaId,
|
||||||
pub proposer_factory: PF,
|
pub proposer_factory: PF,
|
||||||
pub create_inherent_data_providers: CIDP,
|
pub create_inherent_data_providers: CIDP,
|
||||||
pub block_import: BI,
|
pub block_import: ParachainBlockImport<BI>,
|
||||||
pub relay_chain_interface: RCInterface,
|
pub relay_chain_interface: RCInterface,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -217,7 +217,6 @@ pub fn run() -> Result<()> {
|
|||||||
let partials = new_partial(&config)?;
|
let partials = new_partial(&config)?;
|
||||||
let db = partials.backend.expose_db();
|
let db = partials.backend.expose_db();
|
||||||
let storage = partials.backend.expose_storage();
|
let storage = partials.backend.expose_storage();
|
||||||
|
|
||||||
cmd.run(config, partials.client.clone(), db, storage)
|
cmd.run(config, partials.client.clone(), db, storage)
|
||||||
}),
|
}),
|
||||||
BenchmarkCmd::Machine(cmd) =>
|
BenchmarkCmd::Machine(cmd) =>
|
||||||
|
|||||||
@@ -9,7 +9,9 @@ use parachain_template_runtime::{opaque::Block, Hash, RuntimeApi};
|
|||||||
|
|
||||||
// Cumulus Imports
|
// Cumulus Imports
|
||||||
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
|
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
|
||||||
use cumulus_client_consensus_common::ParachainConsensus;
|
use cumulus_client_consensus_common::{
|
||||||
|
ParachainBlockImport as TParachainBlockImport, ParachainConsensus,
|
||||||
|
};
|
||||||
use cumulus_client_network::BlockAnnounceValidator;
|
use cumulus_client_network::BlockAnnounceValidator;
|
||||||
use cumulus_client_service::{
|
use cumulus_client_service::{
|
||||||
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
||||||
@@ -51,6 +53,8 @@ type ParachainClient = TFullClient<Block, RuntimeApi, ParachainExecutor>;
|
|||||||
|
|
||||||
type ParachainBackend = TFullBackend<Block>;
|
type ParachainBackend = TFullBackend<Block>;
|
||||||
|
|
||||||
|
type ParachainBlockImport = TParachainBlockImport<Arc<ParachainClient>>;
|
||||||
|
|
||||||
/// Starts a `ServiceBuilder` for a full service.
|
/// Starts a `ServiceBuilder` for a full service.
|
||||||
///
|
///
|
||||||
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
||||||
@@ -64,7 +68,7 @@ pub fn new_partial(
|
|||||||
(),
|
(),
|
||||||
sc_consensus::DefaultImportQueue<Block, ParachainClient>,
|
sc_consensus::DefaultImportQueue<Block, ParachainClient>,
|
||||||
sc_transaction_pool::FullPool<Block, ParachainClient>,
|
sc_transaction_pool::FullPool<Block, ParachainClient>,
|
||||||
(Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
(ParachainBlockImport, Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
||||||
>,
|
>,
|
||||||
sc_service::Error,
|
sc_service::Error,
|
||||||
> {
|
> {
|
||||||
@@ -109,8 +113,11 @@ pub fn new_partial(
|
|||||||
client.clone(),
|
client.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let block_import = ParachainBlockImport::new(client.clone());
|
||||||
|
|
||||||
let import_queue = build_import_queue(
|
let import_queue = build_import_queue(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
|
block_import.clone(),
|
||||||
config,
|
config,
|
||||||
telemetry.as_ref().map(|telemetry| telemetry.handle()),
|
telemetry.as_ref().map(|telemetry| telemetry.handle()),
|
||||||
&task_manager,
|
&task_manager,
|
||||||
@@ -124,7 +131,7 @@ pub fn new_partial(
|
|||||||
task_manager,
|
task_manager,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
select_chain: (),
|
select_chain: (),
|
||||||
other: (telemetry, telemetry_worker_handle),
|
other: (block_import, telemetry, telemetry_worker_handle),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,7 +170,7 @@ async fn start_node_impl(
|
|||||||
let parachain_config = prepare_node_config(parachain_config);
|
let parachain_config = prepare_node_config(parachain_config);
|
||||||
|
|
||||||
let params = new_partial(¶chain_config)?;
|
let params = new_partial(¶chain_config)?;
|
||||||
let (mut telemetry, telemetry_worker_handle) = params.other;
|
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
|
||||||
|
|
||||||
let client = params.client.clone();
|
let client = params.client.clone();
|
||||||
let backend = params.backend.clone();
|
let backend = params.backend.clone();
|
||||||
@@ -255,6 +262,7 @@ async fn start_node_impl(
|
|||||||
if validator {
|
if validator {
|
||||||
let parachain_consensus = build_consensus(
|
let parachain_consensus = build_consensus(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
|
block_import,
|
||||||
prometheus_registry.as_ref(),
|
prometheus_registry.as_ref(),
|
||||||
telemetry.as_ref().map(|t| t.handle()),
|
telemetry.as_ref().map(|t| t.handle()),
|
||||||
&task_manager,
|
&task_manager,
|
||||||
@@ -304,6 +312,7 @@ async fn start_node_impl(
|
|||||||
/// Build the import queue for the parachain runtime.
|
/// Build the import queue for the parachain runtime.
|
||||||
fn build_import_queue(
|
fn build_import_queue(
|
||||||
client: Arc<ParachainClient>,
|
client: Arc<ParachainClient>,
|
||||||
|
block_import: ParachainBlockImport,
|
||||||
config: &Configuration,
|
config: &Configuration,
|
||||||
telemetry: Option<TelemetryHandle>,
|
telemetry: Option<TelemetryHandle>,
|
||||||
task_manager: &TaskManager,
|
task_manager: &TaskManager,
|
||||||
@@ -318,8 +327,8 @@ fn build_import_queue(
|
|||||||
_,
|
_,
|
||||||
_,
|
_,
|
||||||
>(cumulus_client_consensus_aura::ImportQueueParams {
|
>(cumulus_client_consensus_aura::ImportQueueParams {
|
||||||
block_import: client.clone(),
|
block_import,
|
||||||
client: client.clone(),
|
client,
|
||||||
create_inherent_data_providers: move |_, _| async move {
|
create_inherent_data_providers: move |_, _| async move {
|
||||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
|
|
||||||
@@ -340,6 +349,7 @@ fn build_import_queue(
|
|||||||
|
|
||||||
fn build_consensus(
|
fn build_consensus(
|
||||||
client: Arc<ParachainClient>,
|
client: Arc<ParachainClient>,
|
||||||
|
block_import: ParachainBlockImport,
|
||||||
prometheus_registry: Option<&Registry>,
|
prometheus_registry: Option<&Registry>,
|
||||||
telemetry: Option<TelemetryHandle>,
|
telemetry: Option<TelemetryHandle>,
|
||||||
task_manager: &TaskManager,
|
task_manager: &TaskManager,
|
||||||
@@ -389,7 +399,7 @@ fn build_consensus(
|
|||||||
Ok((slot, timestamp, parachain_inherent))
|
Ok((slot, timestamp, parachain_inherent))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
block_import: client.clone(),
|
block_import,
|
||||||
para_client: client,
|
para_client: client,
|
||||||
backoff_authoring_blocks: Option::<()>::None,
|
backoff_authoring_blocks: Option::<()>::None,
|
||||||
sync_oracle,
|
sync_oracle,
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ use codec::Codec;
|
|||||||
use cumulus_client_cli::CollatorOptions;
|
use cumulus_client_cli::CollatorOptions;
|
||||||
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
|
use cumulus_client_consensus_aura::{AuraConsensus, BuildAuraConsensusParams, SlotProportion};
|
||||||
use cumulus_client_consensus_common::{
|
use cumulus_client_consensus_common::{
|
||||||
ParachainBlockImport, ParachainCandidate, ParachainConsensus,
|
ParachainBlockImport as TParachainBlockImport, ParachainCandidate, ParachainConsensus,
|
||||||
};
|
};
|
||||||
use cumulus_client_network::BlockAnnounceValidator;
|
use cumulus_client_network::BlockAnnounceValidator;
|
||||||
use cumulus_client_service::{
|
use cumulus_client_service::{
|
||||||
@@ -73,6 +73,8 @@ type ParachainClient<RuntimeApi> = TFullClient<Block, RuntimeApi, WasmExecutor<H
|
|||||||
|
|
||||||
type ParachainBackend = TFullBackend<Block>;
|
type ParachainBackend = TFullBackend<Block>;
|
||||||
|
|
||||||
|
type ParachainBlockImport<RuntimeApi> = TParachainBlockImport<Arc<ParachainClient<RuntimeApi>>>;
|
||||||
|
|
||||||
/// Native executor instance.
|
/// Native executor instance.
|
||||||
pub struct ShellRuntimeExecutor;
|
pub struct ShellRuntimeExecutor;
|
||||||
|
|
||||||
@@ -162,7 +164,7 @@ pub fn new_partial<RuntimeApi, BIQ>(
|
|||||||
(),
|
(),
|
||||||
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
|
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
|
||||||
sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>,
|
sc_transaction_pool::FullPool<Block, ParachainClient<RuntimeApi>>,
|
||||||
(Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
(ParachainBlockImport<RuntimeApi>, Option<Telemetry>, Option<TelemetryWorkerHandle>),
|
||||||
>,
|
>,
|
||||||
sc_service::Error,
|
sc_service::Error,
|
||||||
>
|
>
|
||||||
@@ -179,6 +181,7 @@ where
|
|||||||
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||||
BIQ: FnOnce(
|
BIQ: FnOnce(
|
||||||
Arc<ParachainClient<RuntimeApi>>,
|
Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
ParachainBlockImport<RuntimeApi>,
|
||||||
&Configuration,
|
&Configuration,
|
||||||
Option<TelemetryHandle>,
|
Option<TelemetryHandle>,
|
||||||
&TaskManager,
|
&TaskManager,
|
||||||
@@ -229,8 +232,11 @@ where
|
|||||||
client.clone(),
|
client.clone(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let block_import = ParachainBlockImport::new(client.clone());
|
||||||
|
|
||||||
let import_queue = build_import_queue(
|
let import_queue = build_import_queue(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
|
block_import.clone(),
|
||||||
config,
|
config,
|
||||||
telemetry.as_ref().map(|telemetry| telemetry.handle()),
|
telemetry.as_ref().map(|telemetry| telemetry.handle()),
|
||||||
&task_manager,
|
&task_manager,
|
||||||
@@ -244,7 +250,7 @@ where
|
|||||||
task_manager,
|
task_manager,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
select_chain: (),
|
select_chain: (),
|
||||||
other: (telemetry, telemetry_worker_handle),
|
other: (block_import, telemetry, telemetry_worker_handle),
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(params)
|
Ok(params)
|
||||||
@@ -279,7 +285,7 @@ async fn start_shell_node_impl<RuntimeApi, RB, BIQ, BIC>(
|
|||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
collator_options: CollatorOptions,
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
para_id: ParaId,
|
||||||
rpc_ext_builder: RB,
|
rpc_ext_builder: RB,
|
||||||
build_import_queue: BIQ,
|
build_import_queue: BIQ,
|
||||||
build_consensus: BIC,
|
build_consensus: BIC,
|
||||||
@@ -298,10 +304,10 @@ where
|
|||||||
+ cumulus_primitives_core::CollectCollationInfo<Block>,
|
+ cumulus_primitives_core::CollectCollationInfo<Block>,
|
||||||
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||||
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
|
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
|
||||||
+ Send
|
|
||||||
+ 'static,
|
+ 'static,
|
||||||
BIQ: FnOnce(
|
BIQ: FnOnce(
|
||||||
Arc<ParachainClient<RuntimeApi>>,
|
Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
ParachainBlockImport<RuntimeApi>,
|
||||||
&Configuration,
|
&Configuration,
|
||||||
Option<TelemetryHandle>,
|
Option<TelemetryHandle>,
|
||||||
&TaskManager,
|
&TaskManager,
|
||||||
@@ -311,6 +317,7 @@ where
|
|||||||
>,
|
>,
|
||||||
BIC: FnOnce(
|
BIC: FnOnce(
|
||||||
Arc<ParachainClient<RuntimeApi>>,
|
Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
ParachainBlockImport<RuntimeApi>,
|
||||||
Option<&Registry>,
|
Option<&Registry>,
|
||||||
Option<TelemetryHandle>,
|
Option<TelemetryHandle>,
|
||||||
&TaskManager,
|
&TaskManager,
|
||||||
@@ -324,7 +331,7 @@ where
|
|||||||
let parachain_config = prepare_node_config(parachain_config);
|
let parachain_config = prepare_node_config(parachain_config);
|
||||||
|
|
||||||
let params = new_partial::<RuntimeApi, BIQ>(¶chain_config, build_import_queue)?;
|
let params = new_partial::<RuntimeApi, BIQ>(¶chain_config, build_import_queue)?;
|
||||||
let (mut telemetry, telemetry_worker_handle) = params.other;
|
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
|
||||||
|
|
||||||
let client = params.client.clone();
|
let client = params.client.clone();
|
||||||
let backend = params.backend.clone();
|
let backend = params.backend.clone();
|
||||||
@@ -345,7 +352,8 @@ where
|
|||||||
s => s.to_string().into(),
|
s => s.to_string().into(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id);
|
let block_announce_validator =
|
||||||
|
BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id);
|
||||||
|
|
||||||
let force_authoring = parachain_config.force_authoring;
|
let force_authoring = parachain_config.force_authoring;
|
||||||
let validator = parachain_config.role.is_authority();
|
let validator = parachain_config.role.is_authority();
|
||||||
@@ -405,6 +413,7 @@ where
|
|||||||
if validator {
|
if validator {
|
||||||
let parachain_consensus = build_consensus(
|
let parachain_consensus = build_consensus(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
|
block_import,
|
||||||
prometheus_registry.as_ref(),
|
prometheus_registry.as_ref(),
|
||||||
telemetry.as_ref().map(|t| t.handle()),
|
telemetry.as_ref().map(|t| t.handle()),
|
||||||
&task_manager,
|
&task_manager,
|
||||||
@@ -418,7 +427,7 @@ where
|
|||||||
let spawner = task_manager.spawn_handle();
|
let spawner = task_manager.spawn_handle();
|
||||||
|
|
||||||
let params = StartCollatorParams {
|
let params = StartCollatorParams {
|
||||||
para_id: id,
|
para_id,
|
||||||
block_status: client.clone(),
|
block_status: client.clone(),
|
||||||
announce_block,
|
announce_block,
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
@@ -437,7 +446,7 @@ where
|
|||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
announce_block,
|
announce_block,
|
||||||
task_manager: &mut task_manager,
|
task_manager: &mut task_manager,
|
||||||
para_id: id,
|
para_id,
|
||||||
relay_chain_interface,
|
relay_chain_interface,
|
||||||
relay_chain_slot_duration,
|
relay_chain_slot_duration,
|
||||||
import_queue,
|
import_queue,
|
||||||
@@ -459,7 +468,7 @@ async fn start_node_impl<RuntimeApi, RB, BIQ, BIC>(
|
|||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
collator_options: CollatorOptions,
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
para_id: ParaId,
|
||||||
_rpc_ext_builder: RB,
|
_rpc_ext_builder: RB,
|
||||||
build_import_queue: BIQ,
|
build_import_queue: BIQ,
|
||||||
build_consensus: BIC,
|
build_consensus: BIC,
|
||||||
@@ -479,20 +488,20 @@ where
|
|||||||
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
|
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
|
||||||
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
||||||
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||||
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
|
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>,
|
||||||
+ Send
|
|
||||||
+ 'static,
|
|
||||||
BIQ: FnOnce(
|
BIQ: FnOnce(
|
||||||
Arc<ParachainClient<RuntimeApi>>,
|
Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
ParachainBlockImport<RuntimeApi>,
|
||||||
&Configuration,
|
&Configuration,
|
||||||
Option<TelemetryHandle>,
|
Option<TelemetryHandle>,
|
||||||
&TaskManager,
|
&TaskManager,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
|
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
|
||||||
sc_service::Error,
|
sc_service::Error,
|
||||||
> + 'static,
|
>,
|
||||||
BIC: FnOnce(
|
BIC: FnOnce(
|
||||||
Arc<ParachainClient<RuntimeApi>>,
|
Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
ParachainBlockImport<RuntimeApi>,
|
||||||
Option<&Registry>,
|
Option<&Registry>,
|
||||||
Option<TelemetryHandle>,
|
Option<TelemetryHandle>,
|
||||||
&TaskManager,
|
&TaskManager,
|
||||||
@@ -506,7 +515,7 @@ where
|
|||||||
let parachain_config = prepare_node_config(parachain_config);
|
let parachain_config = prepare_node_config(parachain_config);
|
||||||
|
|
||||||
let params = new_partial::<RuntimeApi, BIQ>(¶chain_config, build_import_queue)?;
|
let params = new_partial::<RuntimeApi, BIQ>(¶chain_config, build_import_queue)?;
|
||||||
let (mut telemetry, telemetry_worker_handle) = params.other;
|
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
|
||||||
|
|
||||||
let client = params.client.clone();
|
let client = params.client.clone();
|
||||||
let backend = params.backend.clone();
|
let backend = params.backend.clone();
|
||||||
@@ -526,7 +535,8 @@ where
|
|||||||
s => s.to_string().into(),
|
s => s.to_string().into(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id);
|
let block_announce_validator =
|
||||||
|
BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id);
|
||||||
|
|
||||||
let force_authoring = parachain_config.force_authoring;
|
let force_authoring = parachain_config.force_authoring;
|
||||||
let validator = parachain_config.role.is_authority();
|
let validator = parachain_config.role.is_authority();
|
||||||
@@ -598,6 +608,7 @@ where
|
|||||||
if validator {
|
if validator {
|
||||||
let parachain_consensus = build_consensus(
|
let parachain_consensus = build_consensus(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
|
block_import,
|
||||||
prometheus_registry.as_ref(),
|
prometheus_registry.as_ref(),
|
||||||
telemetry.as_ref().map(|t| t.handle()),
|
telemetry.as_ref().map(|t| t.handle()),
|
||||||
&task_manager,
|
&task_manager,
|
||||||
@@ -611,7 +622,7 @@ where
|
|||||||
let spawner = task_manager.spawn_handle();
|
let spawner = task_manager.spawn_handle();
|
||||||
|
|
||||||
let params = StartCollatorParams {
|
let params = StartCollatorParams {
|
||||||
para_id: id,
|
para_id,
|
||||||
block_status: client.clone(),
|
block_status: client.clone(),
|
||||||
announce_block,
|
announce_block,
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
@@ -630,7 +641,7 @@ where
|
|||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
announce_block,
|
announce_block,
|
||||||
task_manager: &mut task_manager,
|
task_manager: &mut task_manager,
|
||||||
para_id: id,
|
para_id,
|
||||||
relay_chain_interface,
|
relay_chain_interface,
|
||||||
relay_chain_slot_duration,
|
relay_chain_slot_duration,
|
||||||
import_queue,
|
import_queue,
|
||||||
@@ -647,6 +658,7 @@ where
|
|||||||
/// Build the import queue for the rococo parachain runtime.
|
/// Build the import queue for the rococo parachain runtime.
|
||||||
pub fn rococo_parachain_build_import_queue(
|
pub fn rococo_parachain_build_import_queue(
|
||||||
client: Arc<ParachainClient<rococo_parachain_runtime::RuntimeApi>>,
|
client: Arc<ParachainClient<rococo_parachain_runtime::RuntimeApi>>,
|
||||||
|
block_import: ParachainBlockImport<rococo_parachain_runtime::RuntimeApi>,
|
||||||
config: &Configuration,
|
config: &Configuration,
|
||||||
telemetry: Option<TelemetryHandle>,
|
telemetry: Option<TelemetryHandle>,
|
||||||
task_manager: &TaskManager,
|
task_manager: &TaskManager,
|
||||||
@@ -664,7 +676,7 @@ pub fn rococo_parachain_build_import_queue(
|
|||||||
_,
|
_,
|
||||||
_,
|
_,
|
||||||
>(cumulus_client_consensus_aura::ImportQueueParams {
|
>(cumulus_client_consensus_aura::ImportQueueParams {
|
||||||
block_import: client.clone(),
|
block_import,
|
||||||
client,
|
client,
|
||||||
create_inherent_data_providers: move |_, _| async move {
|
create_inherent_data_providers: move |_, _| async move {
|
||||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
@@ -689,7 +701,7 @@ pub async fn start_rococo_parachain_node(
|
|||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
collator_options: CollatorOptions,
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
para_id: ParaId,
|
||||||
hwbench: Option<sc_sysinfo::HwBench>,
|
hwbench: Option<sc_sysinfo::HwBench>,
|
||||||
) -> sc_service::error::Result<(
|
) -> sc_service::error::Result<(
|
||||||
TaskManager,
|
TaskManager,
|
||||||
@@ -699,10 +711,11 @@ pub async fn start_rococo_parachain_node(
|
|||||||
parachain_config,
|
parachain_config,
|
||||||
polkadot_config,
|
polkadot_config,
|
||||||
collator_options,
|
collator_options,
|
||||||
id,
|
para_id,
|
||||||
|_| Ok(RpcModule::new(())),
|
|_| Ok(RpcModule::new(())),
|
||||||
rococo_parachain_build_import_queue,
|
rococo_parachain_build_import_queue,
|
||||||
|client,
|
|client,
|
||||||
|
block_import,
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
telemetry,
|
telemetry,
|
||||||
task_manager,
|
task_manager,
|
||||||
@@ -733,7 +746,7 @@ pub async fn start_rococo_parachain_node(
|
|||||||
relay_parent,
|
relay_parent,
|
||||||
&relay_chain_interface,
|
&relay_chain_interface,
|
||||||
&validation_data,
|
&validation_data,
|
||||||
id,
|
para_id,
|
||||||
).await;
|
).await;
|
||||||
|
|
||||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
@@ -753,7 +766,7 @@ pub async fn start_rococo_parachain_node(
|
|||||||
Ok((slot, timestamp, parachain_inherent))
|
Ok((slot, timestamp, parachain_inherent))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
block_import: client.clone(),
|
block_import,
|
||||||
para_client: client,
|
para_client: client,
|
||||||
backoff_authoring_blocks: Option::<()>::None,
|
backoff_authoring_blocks: Option::<()>::None,
|
||||||
sync_oracle,
|
sync_oracle,
|
||||||
@@ -776,6 +789,7 @@ pub async fn start_rococo_parachain_node(
|
|||||||
/// Build the import queue for the shell runtime.
|
/// Build the import queue for the shell runtime.
|
||||||
pub fn shell_build_import_queue<RuntimeApi>(
|
pub fn shell_build_import_queue<RuntimeApi>(
|
||||||
client: Arc<ParachainClient<RuntimeApi>>,
|
client: Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
block_import: ParachainBlockImport<RuntimeApi>,
|
||||||
config: &Configuration,
|
config: &Configuration,
|
||||||
_: Option<TelemetryHandle>,
|
_: Option<TelemetryHandle>,
|
||||||
task_manager: &TaskManager,
|
task_manager: &TaskManager,
|
||||||
@@ -794,7 +808,7 @@ where
|
|||||||
{
|
{
|
||||||
cumulus_client_consensus_relay_chain::import_queue(
|
cumulus_client_consensus_relay_chain::import_queue(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
client,
|
block_import,
|
||||||
|_, _| async { Ok(()) },
|
|_, _| async { Ok(()) },
|
||||||
&task_manager.spawn_essential_handle(),
|
&task_manager.spawn_essential_handle(),
|
||||||
config.prometheus_registry(),
|
config.prometheus_registry(),
|
||||||
@@ -807,7 +821,7 @@ pub async fn start_shell_node<RuntimeApi>(
|
|||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
collator_options: CollatorOptions,
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
para_id: ParaId,
|
||||||
hwbench: Option<sc_sysinfo::HwBench>,
|
hwbench: Option<sc_sysinfo::HwBench>,
|
||||||
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient<RuntimeApi>>)>
|
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient<RuntimeApi>>)>
|
||||||
where
|
where
|
||||||
@@ -827,10 +841,11 @@ where
|
|||||||
parachain_config,
|
parachain_config,
|
||||||
polkadot_config,
|
polkadot_config,
|
||||||
collator_options,
|
collator_options,
|
||||||
id,
|
para_id,
|
||||||
|_| Ok(RpcModule::new(())),
|
|_| Ok(RpcModule::new(())),
|
||||||
shell_build_import_queue,
|
shell_build_import_queue,
|
||||||
|client,
|
|client,
|
||||||
|
block_import,
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
telemetry,
|
telemetry,
|
||||||
task_manager,
|
task_manager,
|
||||||
@@ -841,7 +856,7 @@ where
|
|||||||
_| {
|
_| {
|
||||||
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
|
let proposer_factory = sc_basic_authorship::ProposerFactory::with_proof_recording(
|
||||||
task_manager.spawn_handle(),
|
task_manager.spawn_handle(),
|
||||||
client.clone(),
|
client,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
telemetry,
|
telemetry,
|
||||||
@@ -849,9 +864,9 @@ where
|
|||||||
|
|
||||||
Ok(cumulus_client_consensus_relay_chain::build_relay_chain_consensus(
|
Ok(cumulus_client_consensus_relay_chain::build_relay_chain_consensus(
|
||||||
cumulus_client_consensus_relay_chain::BuildRelayChainConsensusParams {
|
cumulus_client_consensus_relay_chain::BuildRelayChainConsensusParams {
|
||||||
para_id: id,
|
para_id,
|
||||||
proposer_factory,
|
proposer_factory,
|
||||||
block_import: client,
|
block_import,
|
||||||
relay_chain_interface: relay_chain_interface.clone(),
|
relay_chain_interface: relay_chain_interface.clone(),
|
||||||
create_inherent_data_providers: move |_, (relay_parent, validation_data)| {
|
create_inherent_data_providers: move |_, (relay_parent, validation_data)| {
|
||||||
let relay_chain_interface = relay_chain_interface.clone();
|
let relay_chain_interface = relay_chain_interface.clone();
|
||||||
@@ -861,7 +876,7 @@ where
|
|||||||
relay_parent,
|
relay_parent,
|
||||||
&relay_chain_interface,
|
&relay_chain_interface,
|
||||||
&validation_data,
|
&validation_data,
|
||||||
id,
|
para_id,
|
||||||
).await;
|
).await;
|
||||||
let parachain_inherent = parachain_inherent.ok_or_else(|| {
|
let parachain_inherent = parachain_inherent.ok_or_else(|| {
|
||||||
Box::<dyn std::error::Error + Send + Sync>::from(
|
Box::<dyn std::error::Error + Send + Sync>::from(
|
||||||
@@ -989,6 +1004,7 @@ where
|
|||||||
/// Build the import queue for Statemint and other Aura-based runtimes.
|
/// Build the import queue for Statemint and other Aura-based runtimes.
|
||||||
pub fn aura_build_import_queue<RuntimeApi, AuraId: AppKey>(
|
pub fn aura_build_import_queue<RuntimeApi, AuraId: AppKey>(
|
||||||
client: Arc<ParachainClient<RuntimeApi>>,
|
client: Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
block_import: ParachainBlockImport<RuntimeApi>,
|
||||||
config: &Configuration,
|
config: &Configuration,
|
||||||
telemetry_handle: Option<TelemetryHandle>,
|
telemetry_handle: Option<TelemetryHandle>,
|
||||||
task_manager: &TaskManager,
|
task_manager: &TaskManager,
|
||||||
@@ -1045,13 +1061,7 @@ where
|
|||||||
let registry = config.prometheus_registry();
|
let registry = config.prometheus_registry();
|
||||||
let spawner = task_manager.spawn_essential_handle();
|
let spawner = task_manager.spawn_essential_handle();
|
||||||
|
|
||||||
Ok(BasicQueue::new(
|
Ok(BasicQueue::new(verifier, Box::new(block_import), None, &spawner, registry))
|
||||||
verifier,
|
|
||||||
Box::new(ParachainBlockImport::new(client)),
|
|
||||||
None,
|
|
||||||
&spawner,
|
|
||||||
registry,
|
|
||||||
))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Start an aura powered parachain node.
|
/// Start an aura powered parachain node.
|
||||||
@@ -1060,7 +1070,7 @@ pub async fn start_generic_aura_node<RuntimeApi, AuraId: AppKey>(
|
|||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
collator_options: CollatorOptions,
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
para_id: ParaId,
|
||||||
hwbench: Option<sc_sysinfo::HwBench>,
|
hwbench: Option<sc_sysinfo::HwBench>,
|
||||||
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient<RuntimeApi>>)>
|
) -> sc_service::error::Result<(TaskManager, Arc<ParachainClient<RuntimeApi>>)>
|
||||||
where
|
where
|
||||||
@@ -1085,10 +1095,11 @@ where
|
|||||||
parachain_config,
|
parachain_config,
|
||||||
polkadot_config,
|
polkadot_config,
|
||||||
collator_options,
|
collator_options,
|
||||||
id,
|
para_id,
|
||||||
|_| Ok(RpcModule::new(())),
|
|_| Ok(RpcModule::new(())),
|
||||||
aura_build_import_queue::<_, AuraId>,
|
aura_build_import_queue::<_, AuraId>,
|
||||||
|client,
|
|client,
|
||||||
|
block_import,
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
telemetry,
|
telemetry,
|
||||||
task_manager,
|
task_manager,
|
||||||
@@ -1097,8 +1108,9 @@ where
|
|||||||
sync_oracle,
|
sync_oracle,
|
||||||
keystore,
|
keystore,
|
||||||
force_authoring| {
|
force_authoring| {
|
||||||
let client2 = client.clone();
|
|
||||||
let spawn_handle = task_manager.spawn_handle();
|
let spawn_handle = task_manager.spawn_handle();
|
||||||
|
let client2 = client.clone();
|
||||||
|
let block_import2 = block_import.clone();
|
||||||
let transaction_pool2 = transaction_pool.clone();
|
let transaction_pool2 = transaction_pool.clone();
|
||||||
let telemetry2 = telemetry.clone();
|
let telemetry2 = telemetry.clone();
|
||||||
let prometheus_registry2 = prometheus_registry.map(|r| (*r).clone());
|
let prometheus_registry2 = prometheus_registry.map(|r| (*r).clone());
|
||||||
@@ -1127,7 +1139,7 @@ where
|
|||||||
relay_parent,
|
relay_parent,
|
||||||
&relay_chain_for_aura,
|
&relay_chain_for_aura,
|
||||||
&validation_data,
|
&validation_data,
|
||||||
id,
|
para_id,
|
||||||
).await;
|
).await;
|
||||||
|
|
||||||
let timestamp =
|
let timestamp =
|
||||||
@@ -1149,8 +1161,8 @@ where
|
|||||||
Ok((slot, timestamp, parachain_inherent))
|
Ok((slot, timestamp, parachain_inherent))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
block_import: client2.clone(),
|
block_import: block_import2,
|
||||||
para_client: client2.clone(),
|
para_client: client2,
|
||||||
backoff_authoring_blocks: Option::<()>::None,
|
backoff_authoring_blocks: Option::<()>::None,
|
||||||
sync_oracle,
|
sync_oracle,
|
||||||
keystore,
|
keystore,
|
||||||
@@ -1176,9 +1188,9 @@ where
|
|||||||
let relay_chain_consensus =
|
let relay_chain_consensus =
|
||||||
cumulus_client_consensus_relay_chain::build_relay_chain_consensus(
|
cumulus_client_consensus_relay_chain::build_relay_chain_consensus(
|
||||||
cumulus_client_consensus_relay_chain::BuildRelayChainConsensusParams {
|
cumulus_client_consensus_relay_chain::BuildRelayChainConsensusParams {
|
||||||
para_id: id,
|
para_id,
|
||||||
proposer_factory,
|
proposer_factory,
|
||||||
block_import: client.clone(),
|
block_import,
|
||||||
relay_chain_interface: relay_chain_interface.clone(),
|
relay_chain_interface: relay_chain_interface.clone(),
|
||||||
create_inherent_data_providers:
|
create_inherent_data_providers:
|
||||||
move |_, (relay_parent, validation_data)| {
|
move |_, (relay_parent, validation_data)| {
|
||||||
@@ -1189,7 +1201,7 @@ where
|
|||||||
relay_parent,
|
relay_parent,
|
||||||
&relay_chain_interface,
|
&relay_chain_interface,
|
||||||
&validation_data,
|
&validation_data,
|
||||||
id,
|
para_id,
|
||||||
).await;
|
).await;
|
||||||
let parachain_inherent =
|
let parachain_inherent =
|
||||||
parachain_inherent.ok_or_else(|| {
|
parachain_inherent.ok_or_else(|| {
|
||||||
@@ -1222,7 +1234,7 @@ async fn start_contracts_rococo_node_impl<RuntimeApi, RB, BIQ, BIC>(
|
|||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
collator_options: CollatorOptions,
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
para_id: ParaId,
|
||||||
_rpc_ext_builder: RB,
|
_rpc_ext_builder: RB,
|
||||||
build_import_queue: BIQ,
|
build_import_queue: BIQ,
|
||||||
build_consensus: BIC,
|
build_consensus: BIC,
|
||||||
@@ -1242,20 +1254,20 @@ where
|
|||||||
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
|
+ pallet_transaction_payment_rpc::TransactionPaymentRuntimeApi<Block, Balance>
|
||||||
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
+ frame_rpc_system::AccountNonceApi<Block, AccountId, Nonce>,
|
||||||
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
sc_client_api::StateBackendFor<ParachainBackend, Block>: sp_api::StateBackend<BlakeTwo256>,
|
||||||
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>
|
RB: Fn(Arc<ParachainClient<RuntimeApi>>) -> Result<jsonrpsee::RpcModule<()>, sc_service::Error>,
|
||||||
+ Send
|
|
||||||
+ 'static,
|
|
||||||
BIQ: FnOnce(
|
BIQ: FnOnce(
|
||||||
Arc<ParachainClient<RuntimeApi>>,
|
Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
ParachainBlockImport<RuntimeApi>,
|
||||||
&Configuration,
|
&Configuration,
|
||||||
Option<TelemetryHandle>,
|
Option<TelemetryHandle>,
|
||||||
&TaskManager,
|
&TaskManager,
|
||||||
) -> Result<
|
) -> Result<
|
||||||
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
|
sc_consensus::DefaultImportQueue<Block, ParachainClient<RuntimeApi>>,
|
||||||
sc_service::Error,
|
sc_service::Error,
|
||||||
> + 'static,
|
>,
|
||||||
BIC: FnOnce(
|
BIC: FnOnce(
|
||||||
Arc<ParachainClient<RuntimeApi>>,
|
Arc<ParachainClient<RuntimeApi>>,
|
||||||
|
ParachainBlockImport<RuntimeApi>,
|
||||||
Option<&Registry>,
|
Option<&Registry>,
|
||||||
Option<TelemetryHandle>,
|
Option<TelemetryHandle>,
|
||||||
&TaskManager,
|
&TaskManager,
|
||||||
@@ -1269,7 +1281,7 @@ where
|
|||||||
let parachain_config = prepare_node_config(parachain_config);
|
let parachain_config = prepare_node_config(parachain_config);
|
||||||
|
|
||||||
let params = new_partial::<RuntimeApi, BIQ>(¶chain_config, build_import_queue)?;
|
let params = new_partial::<RuntimeApi, BIQ>(¶chain_config, build_import_queue)?;
|
||||||
let (mut telemetry, telemetry_worker_handle) = params.other;
|
let (block_import, mut telemetry, telemetry_worker_handle) = params.other;
|
||||||
|
|
||||||
let client = params.client.clone();
|
let client = params.client.clone();
|
||||||
let backend = params.backend.clone();
|
let backend = params.backend.clone();
|
||||||
@@ -1289,7 +1301,8 @@ where
|
|||||||
s => s.to_string().into(),
|
s => s.to_string().into(),
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
let block_announce_validator = BlockAnnounceValidator::new(relay_chain_interface.clone(), id);
|
let block_announce_validator =
|
||||||
|
BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id);
|
||||||
|
|
||||||
let force_authoring = parachain_config.force_authoring;
|
let force_authoring = parachain_config.force_authoring;
|
||||||
let validator = parachain_config.role.is_authority();
|
let validator = parachain_config.role.is_authority();
|
||||||
@@ -1361,6 +1374,7 @@ where
|
|||||||
if validator {
|
if validator {
|
||||||
let parachain_consensus = build_consensus(
|
let parachain_consensus = build_consensus(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
|
block_import,
|
||||||
prometheus_registry.as_ref(),
|
prometheus_registry.as_ref(),
|
||||||
telemetry.as_ref().map(|t| t.handle()),
|
telemetry.as_ref().map(|t| t.handle()),
|
||||||
&task_manager,
|
&task_manager,
|
||||||
@@ -1374,7 +1388,7 @@ where
|
|||||||
let spawner = task_manager.spawn_handle();
|
let spawner = task_manager.spawn_handle();
|
||||||
|
|
||||||
let params = StartCollatorParams {
|
let params = StartCollatorParams {
|
||||||
para_id: id,
|
para_id,
|
||||||
block_status: client.clone(),
|
block_status: client.clone(),
|
||||||
announce_block,
|
announce_block,
|
||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
@@ -1393,7 +1407,7 @@ where
|
|||||||
client: client.clone(),
|
client: client.clone(),
|
||||||
announce_block,
|
announce_block,
|
||||||
task_manager: &mut task_manager,
|
task_manager: &mut task_manager,
|
||||||
para_id: id,
|
para_id,
|
||||||
relay_chain_interface,
|
relay_chain_interface,
|
||||||
relay_chain_slot_duration,
|
relay_chain_slot_duration,
|
||||||
import_queue,
|
import_queue,
|
||||||
@@ -1410,6 +1424,7 @@ where
|
|||||||
#[allow(clippy::type_complexity)]
|
#[allow(clippy::type_complexity)]
|
||||||
pub fn contracts_rococo_build_import_queue(
|
pub fn contracts_rococo_build_import_queue(
|
||||||
client: Arc<ParachainClient<contracts_rococo_runtime::RuntimeApi>>,
|
client: Arc<ParachainClient<contracts_rococo_runtime::RuntimeApi>>,
|
||||||
|
block_import: ParachainBlockImport<contracts_rococo_runtime::RuntimeApi>,
|
||||||
config: &Configuration,
|
config: &Configuration,
|
||||||
telemetry: Option<TelemetryHandle>,
|
telemetry: Option<TelemetryHandle>,
|
||||||
task_manager: &TaskManager,
|
task_manager: &TaskManager,
|
||||||
@@ -1427,7 +1442,7 @@ pub fn contracts_rococo_build_import_queue(
|
|||||||
_,
|
_,
|
||||||
_,
|
_,
|
||||||
>(cumulus_client_consensus_aura::ImportQueueParams {
|
>(cumulus_client_consensus_aura::ImportQueueParams {
|
||||||
block_import: client.clone(),
|
block_import,
|
||||||
client,
|
client,
|
||||||
create_inherent_data_providers: move |_, _| async move {
|
create_inherent_data_providers: move |_, _| async move {
|
||||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
@@ -1452,7 +1467,7 @@ pub async fn start_contracts_rococo_node(
|
|||||||
parachain_config: Configuration,
|
parachain_config: Configuration,
|
||||||
polkadot_config: Configuration,
|
polkadot_config: Configuration,
|
||||||
collator_options: CollatorOptions,
|
collator_options: CollatorOptions,
|
||||||
id: ParaId,
|
para_id: ParaId,
|
||||||
hwbench: Option<sc_sysinfo::HwBench>,
|
hwbench: Option<sc_sysinfo::HwBench>,
|
||||||
) -> sc_service::error::Result<(
|
) -> sc_service::error::Result<(
|
||||||
TaskManager,
|
TaskManager,
|
||||||
@@ -1462,10 +1477,11 @@ pub async fn start_contracts_rococo_node(
|
|||||||
parachain_config,
|
parachain_config,
|
||||||
polkadot_config,
|
polkadot_config,
|
||||||
collator_options,
|
collator_options,
|
||||||
id,
|
para_id,
|
||||||
|_| Ok(RpcModule::new(())),
|
|_| Ok(RpcModule::new(())),
|
||||||
contracts_rococo_build_import_queue,
|
contracts_rococo_build_import_queue,
|
||||||
|client,
|
|client,
|
||||||
|
block_import,
|
||||||
prometheus_registry,
|
prometheus_registry,
|
||||||
telemetry,
|
telemetry,
|
||||||
task_manager,
|
task_manager,
|
||||||
@@ -1495,7 +1511,7 @@ pub async fn start_contracts_rococo_node(
|
|||||||
relay_parent,
|
relay_parent,
|
||||||
&relay_chain_interface,
|
&relay_chain_interface,
|
||||||
&validation_data,
|
&validation_data,
|
||||||
id,
|
para_id,
|
||||||
).await;
|
).await;
|
||||||
|
|
||||||
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
|
||||||
@@ -1515,7 +1531,7 @@ pub async fn start_contracts_rococo_node(
|
|||||||
Ok((slot, timestamp, parachain_inherent))
|
Ok((slot, timestamp, parachain_inherent))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
block_import: client.clone(),
|
block_import,
|
||||||
para_client: client,
|
para_client: client,
|
||||||
backoff_authoring_blocks: Option::<()>::None,
|
backoff_authoring_blocks: Option::<()>::None,
|
||||||
sync_oracle,
|
sync_oracle,
|
||||||
|
|||||||
@@ -30,7 +30,9 @@ use url::Url;
|
|||||||
|
|
||||||
use crate::runtime::Weight;
|
use crate::runtime::Weight;
|
||||||
use cumulus_client_cli::CollatorOptions;
|
use cumulus_client_cli::CollatorOptions;
|
||||||
use cumulus_client_consensus_common::{ParachainCandidate, ParachainConsensus};
|
use cumulus_client_consensus_common::{
|
||||||
|
ParachainBlockImport as TParachainBlockImport, ParachainCandidate, ParachainConsensus,
|
||||||
|
};
|
||||||
use cumulus_client_network::BlockAnnounceValidator;
|
use cumulus_client_network::BlockAnnounceValidator;
|
||||||
use cumulus_client_service::{
|
use cumulus_client_service::{
|
||||||
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
prepare_node_config, start_collator, start_full_node, StartCollatorParams, StartFullNodeParams,
|
||||||
@@ -117,6 +119,8 @@ pub type Client = TFullClient<
|
|||||||
/// Transaction pool type used by the test service
|
/// Transaction pool type used by the test service
|
||||||
pub type TransactionPool = Arc<sc_transaction_pool::FullPool<Block, Client>>;
|
pub type TransactionPool = Arc<sc_transaction_pool::FullPool<Block, Client>>;
|
||||||
|
|
||||||
|
type ParachainBlockImport = TParachainBlockImport<Arc<Client>>;
|
||||||
|
|
||||||
/// Starts a `ServiceBuilder` for a full service.
|
/// Starts a `ServiceBuilder` for a full service.
|
||||||
///
|
///
|
||||||
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
/// Use this macro if you don't actually need the full service, but just the builder in order to
|
||||||
@@ -130,7 +134,7 @@ pub fn new_partial(
|
|||||||
(),
|
(),
|
||||||
sc_consensus::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
|
sc_consensus::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
|
||||||
sc_transaction_pool::FullPool<Block, Client>,
|
sc_transaction_pool::FullPool<Block, Client>,
|
||||||
(),
|
ParachainBlockImport,
|
||||||
>,
|
>,
|
||||||
sc_service::Error,
|
sc_service::Error,
|
||||||
> {
|
> {
|
||||||
@@ -145,6 +149,8 @@ pub fn new_partial(
|
|||||||
sc_service::new_full_parts::<Block, RuntimeApi, _>(config, None, executor)?;
|
sc_service::new_full_parts::<Block, RuntimeApi, _>(config, None, executor)?;
|
||||||
let client = Arc::new(client);
|
let client = Arc::new(client);
|
||||||
|
|
||||||
|
let block_import = ParachainBlockImport::new(client.clone());
|
||||||
|
|
||||||
let registry = config.prometheus_registry();
|
let registry = config.prometheus_registry();
|
||||||
|
|
||||||
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
|
let transaction_pool = sc_transaction_pool::BasicPool::new_full(
|
||||||
@@ -157,7 +163,7 @@ pub fn new_partial(
|
|||||||
|
|
||||||
let import_queue = cumulus_client_consensus_relay_chain::import_queue(
|
let import_queue = cumulus_client_consensus_relay_chain::import_queue(
|
||||||
client.clone(),
|
client.clone(),
|
||||||
client.clone(),
|
block_import.clone(),
|
||||||
|_, _| async { Ok(sp_timestamp::InherentDataProvider::from_system_time()) },
|
|_, _| async { Ok(sp_timestamp::InherentDataProvider::from_system_time()) },
|
||||||
&task_manager.spawn_essential_handle(),
|
&task_manager.spawn_essential_handle(),
|
||||||
registry,
|
registry,
|
||||||
@@ -171,7 +177,7 @@ pub fn new_partial(
|
|||||||
task_manager,
|
task_manager,
|
||||||
transaction_pool,
|
transaction_pool,
|
||||||
select_chain: (),
|
select_chain: (),
|
||||||
other: (),
|
other: block_import,
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(params)
|
Ok(params)
|
||||||
@@ -244,6 +250,8 @@ where
|
|||||||
let client = params.client.clone();
|
let client = params.client.clone();
|
||||||
let backend = params.backend.clone();
|
let backend = params.backend.clone();
|
||||||
|
|
||||||
|
let block_import = params.other;
|
||||||
|
|
||||||
let relay_chain_interface = build_relay_chain_interface(
|
let relay_chain_interface = build_relay_chain_interface(
|
||||||
relay_chain_config,
|
relay_chain_config,
|
||||||
collator_key.clone(),
|
collator_key.clone(),
|
||||||
@@ -275,7 +283,6 @@ where
|
|||||||
|
|
||||||
let rpc_builder = {
|
let rpc_builder = {
|
||||||
let client = client.clone();
|
let client = client.clone();
|
||||||
|
|
||||||
Box::new(move |_, _| rpc_ext_builder(client.clone()))
|
Box::new(move |_, _| rpc_ext_builder(client.clone()))
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -338,7 +345,7 @@ where
|
|||||||
Ok((time, parachain_inherent))
|
Ok((time, parachain_inherent))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
client.clone(),
|
block_import,
|
||||||
relay_chain_interface2,
|
relay_chain_interface2,
|
||||||
))
|
))
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user