mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-20 19:45:41 +00:00
start working on building the real overseer (#1795)
* start working on building the real overseer Unfortunately, this fails to compile right now due to an upstream failure to compile which is probably brought on by a recent upgrade to rustc v1.47. * fill in AllSubsystems internal constructors * replace fn make_metrics with Metrics::attempt_to_register * update to account for #1740 * remove Metrics::register, rename Metrics::attempt_to_register * add 'static bounds to real_overseer type params * pass authority_discovery and network_service to real_overseer It's not straightforwardly obvious that this is the best way to handle the case when there is no authority discovery service, but it seems to be the best option available at the moment. * select a proper database configuration for the availability store db * use subdirectory for av-store database path * apply Basti's patch which avoids needing to parameterize everything on Block * simplify path extraction * get all tests to compile * Fix Prometheus double-registry error for debugging purposes, added this to node/subsystem-util/src/lib.rs:472-476: ```rust Some(registry) => Self::try_register(registry).map_err(|err| { eprintln!("PrometheusError calling {}::register: {:?}", std::any::type_name::<Self>(), err); err }), ``` That pointed out where the registration was failing, which led to this fix. The test still doesn't pass, but it now fails in a new and different way! * authorities must have authority discovery, but not necessarily overseer handlers * fix broken SpawnedSubsystem impls detailed logging determined that using the `Box::new` style of future generation, the `self.run` method was never being called, leading to dropped receivers / closed senders for those subsystems, causing the overseer to shut down immediately. This is not the final fix needed to get things working properly, but it's a good start. * use prometheus properly Prometheus lets us register simple counters, which aren't very interesting. It also allows us to register CounterVecs, which are. With a CounterVec, you can provide a set of labels, which can later be used to filter the counts. We were using them wrong, though. This pattern was repeated in a variety of places in the code: ```rust // panics with an cardinality mismatch let my_counter = register(CounterVec::new(opts, &["succeeded", "failed"])?, registry)?; my_counter.with_label_values(&["succeeded"]).inc() ``` The problem is that the labels provided in the constructor are not the set of legal values which can be annotated, but a set of individual label names which can have individual, arbitrary values. This commit fixes that. * get av-store subsystem to actually run properly and not die on first signal * typo fix: incomming -> incoming * don't disable authority discovery in test nodes * Fix rococo-v1 missing session keys * Update node/core/av-store/Cargo.toml * try dummying out av-store on non-full-nodes * overseer and subsystems are required only for full nodes * Reduce the amount of warnings on browser target * Fix two more warnings * InclusionInherent should actually have an Inherent module on rococo * Ancestry: don't return genesis' parent hash * Update Cargo.lock * fix broken test * update test script: specify chainspec as script argument * Apply suggestions from code review Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * Update node/service/src/lib.rs Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> * node/service/src/lib: Return error via ? operator * post-merge blues * add is_collator flag * prevent occasional av-store test panic * simplify fix; expand application * run authority_discovery in Role::Discover when collating * distinguish between proposer closed channel errors * add IsCollator enum, remove is_collator CLI flag * improve formatting * remove nop loop * Fix some stuff Co-authored-by: Andronik Ordian <write@reusable.software> Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com> Co-authored-by: Robert Habermeier <robert@Roberts-MBP.lan1> Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com> Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
committed by
GitHub
parent
5fbb8a381c
commit
1a25c41277
@@ -134,13 +134,14 @@ fn westend_session_keys(
|
||||
|
||||
fn rococo_session_keys(
|
||||
babe: BabeId,
|
||||
_grandpa: GrandpaId,
|
||||
grandpa: GrandpaId,
|
||||
im_online: ImOnlineId,
|
||||
parachain_validator: ValidatorId,
|
||||
authority_discovery: AuthorityDiscoveryId
|
||||
) -> rococo_runtime::SessionKeys {
|
||||
rococo_runtime::SessionKeys {
|
||||
babe,
|
||||
grandpa,
|
||||
im_online,
|
||||
parachain_validator,
|
||||
authority_discovery,
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
//! Polkadot-specific GRANDPA integration utilities.
|
||||
|
||||
#[cfg(feature = "full-node")]
|
||||
use polkadot_primitives::v1::Hash;
|
||||
use sp_runtime::traits::{Block as BlockT, NumberFor};
|
||||
|
||||
@@ -94,6 +95,7 @@ where
|
||||
/// intermediary pending changes are replaced with a static list comprised of
|
||||
/// w3f validators and randomly selected validators from the latest session (at
|
||||
/// #1500988).
|
||||
#[cfg(feature = "full-node")]
|
||||
pub(crate) fn kusama_hard_forks() -> Vec<(
|
||||
grandpa_primitives::SetId,
|
||||
(Hash, polkadot_primitives::v1::BlockNumber),
|
||||
|
||||
@@ -24,27 +24,34 @@ mod client;
|
||||
|
||||
use grandpa::{self, FinalityProofProvider as GrandpaFinalityProofProvider};
|
||||
#[cfg(feature = "full-node")]
|
||||
use log::info;
|
||||
use polkadot_node_core_proposer::ProposerFactory;
|
||||
use polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandler};
|
||||
use polkadot_subsystem::DummySubsystem;
|
||||
use prometheus_endpoint::Registry;
|
||||
use sc_client_api::ExecutorProvider;
|
||||
use sc_executor::native_executor_instance;
|
||||
use service::{error::Error as ServiceError, RpcHandlers};
|
||||
use sp_blockchain::HeaderBackend;
|
||||
use sp_core::traits::SpawnNamed;
|
||||
use sp_trie::PrefixedMemoryDB;
|
||||
use {
|
||||
std::convert::TryInto,
|
||||
std::time::Duration,
|
||||
|
||||
log::info,
|
||||
polkadot_node_core_av_store::Config as AvailabilityConfig,
|
||||
polkadot_node_core_proposer::ProposerFactory,
|
||||
polkadot_overseer::{AllSubsystems, BlockInfo, Overseer, OverseerHandler},
|
||||
polkadot_primitives::v1::ParachainHost,
|
||||
authority_discovery::Service as AuthorityDiscoveryService,
|
||||
sp_blockchain::HeaderBackend,
|
||||
sp_core::traits::SpawnNamed,
|
||||
sp_keystore::SyncCryptoStorePtr,
|
||||
sp_trie::PrefixedMemoryDB,
|
||||
sc_client_api::ExecutorProvider,
|
||||
};
|
||||
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
|
||||
use prometheus_endpoint::Registry;
|
||||
use sc_executor::native_executor_instance;
|
||||
use service::RpcHandlers;
|
||||
|
||||
pub use self::client::{AbstractClient, Client, ClientHandle, ExecuteWithClient, RuntimeApiCollection};
|
||||
pub use chain_spec::{PolkadotChainSpec, KusamaChainSpec, WestendChainSpec, RococoChainSpec};
|
||||
#[cfg(feature = "full-node")]
|
||||
pub use codec::Codec;
|
||||
pub use consensus_common::{Proposal, SelectChain, BlockImport, RecordProof, block_validation::Chain};
|
||||
pub use polkadot_parachain::wasm_executor::run_worker as run_validation_worker;
|
||||
pub use polkadot_primitives::v1::{Block, BlockId, CollatorId, Id as ParaId};
|
||||
pub use polkadot_primitives::v1::{Block, BlockId, CollatorId, Hash, Id as ParaId};
|
||||
pub use sc_client_api::{Backend, ExecutionStrategy, CallExecutor};
|
||||
pub use sc_consensus::LongestChain;
|
||||
pub use sc_executor::NativeExecutionDispatch;
|
||||
@@ -115,7 +122,7 @@ impl IdentifyVariant for Box<dyn ChainSpec> {
|
||||
}
|
||||
|
||||
// If we're using prometheus, use a registry with a prefix of `polkadot`.
|
||||
fn set_prometheus_registry(config: &mut Configuration) -> Result<(), ServiceError> {
|
||||
fn set_prometheus_registry(config: &mut Configuration) -> Result<(), Error> {
|
||||
if let Some(PrometheusConfig { registry, .. }) = config.prometheus_config.as_mut() {
|
||||
*registry = Registry::new_custom(Some("polkadot".into()), None)?;
|
||||
}
|
||||
@@ -124,8 +131,10 @@ fn set_prometheus_registry(config: &mut Configuration) -> Result<(), ServiceErro
|
||||
}
|
||||
|
||||
pub type FullBackend = service::TFullBackend<Block>;
|
||||
#[cfg(feature = "full-node")]
|
||||
type FullSelectChain = sc_consensus::LongestChain<FullBackend, Block>;
|
||||
pub type FullClient<RuntimeApi, Executor> = service::TFullClient<Block, RuntimeApi, Executor>;
|
||||
#[cfg(feature = "full-node")]
|
||||
type FullGrandpaBlockImport<RuntimeApi, Executor> = grandpa::GrandpaBlockImport<
|
||||
FullBackend, Block, FullClient<RuntimeApi, Executor>, FullSelectChain
|
||||
>;
|
||||
@@ -276,42 +285,115 @@ fn new_partial<RuntimeApi, Executor>(config: &mut Configuration) -> Result<
|
||||
})
|
||||
}
|
||||
|
||||
fn real_overseer<S: SpawnNamed>(
|
||||
#[cfg(feature="full-node")]
|
||||
fn real_overseer<Spawner, RuntimeClient>(
|
||||
leaves: impl IntoIterator<Item = BlockInfo>,
|
||||
prometheus_registry: Option<&Registry>,
|
||||
s: S,
|
||||
) -> Result<(Overseer<S>, OverseerHandler), ServiceError> {
|
||||
keystore: SyncCryptoStorePtr,
|
||||
runtime_client: Arc<RuntimeClient>,
|
||||
availability_config: AvailabilityConfig,
|
||||
network_service: Arc<sc_network::NetworkService<Block, Hash>>,
|
||||
authority_discovery: AuthorityDiscoveryService,
|
||||
registry: Option<&Registry>,
|
||||
spawner: Spawner,
|
||||
) -> Result<(Overseer<Spawner>, OverseerHandler), Error>
|
||||
where
|
||||
RuntimeClient: 'static + ProvideRuntimeApi<Block> + HeaderBackend<Block>,
|
||||
RuntimeClient::Api: ParachainHost<Block>,
|
||||
Spawner: 'static + SpawnNamed + Clone + Unpin,
|
||||
{
|
||||
use polkadot_node_subsystem_util::metrics::Metrics;
|
||||
|
||||
use polkadot_availability_distribution::AvailabilityDistributionSubsystem;
|
||||
use polkadot_node_core_av_store::AvailabilityStoreSubsystem;
|
||||
use polkadot_availability_bitfield_distribution::BitfieldDistribution as BitfieldDistributionSubsystem;
|
||||
use polkadot_node_core_bitfield_signing::BitfieldSigningSubsystem;
|
||||
use polkadot_node_core_backing::CandidateBackingSubsystem;
|
||||
use polkadot_node_core_candidate_selection::CandidateSelectionSubsystem;
|
||||
use polkadot_node_core_candidate_validation::CandidateValidationSubsystem;
|
||||
use polkadot_node_core_chain_api::ChainApiSubsystem;
|
||||
use polkadot_node_collation_generation::CollationGenerationSubsystem;
|
||||
use polkadot_collator_protocol::{CollatorProtocolSubsystem, ProtocolSide};
|
||||
use polkadot_network_bridge::NetworkBridge as NetworkBridgeSubsystem;
|
||||
use polkadot_pov_distribution::PoVDistribution as PoVDistributionSubsystem;
|
||||
use polkadot_node_core_provisioner::ProvisioningSubsystem as ProvisionerSubsystem;
|
||||
use polkadot_node_core_runtime_api::RuntimeApiSubsystem;
|
||||
use polkadot_statement_distribution::StatementDistribution as StatementDistributionSubsystem;
|
||||
|
||||
let all_subsystems = AllSubsystems {
|
||||
candidate_validation: DummySubsystem,
|
||||
candidate_backing: DummySubsystem,
|
||||
candidate_selection: DummySubsystem,
|
||||
statement_distribution: DummySubsystem,
|
||||
availability_distribution: DummySubsystem,
|
||||
bitfield_signing: DummySubsystem,
|
||||
bitfield_distribution: DummySubsystem,
|
||||
provisioner: DummySubsystem,
|
||||
pov_distribution: DummySubsystem,
|
||||
runtime_api: DummySubsystem,
|
||||
availability_store: DummySubsystem,
|
||||
network_bridge: DummySubsystem,
|
||||
chain_api: DummySubsystem,
|
||||
collation_generation: DummySubsystem,
|
||||
collator_protocol: DummySubsystem,
|
||||
availability_distribution: AvailabilityDistributionSubsystem::new(
|
||||
keystore.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
availability_store: AvailabilityStoreSubsystem::new_on_disk(
|
||||
availability_config,
|
||||
Metrics::register(registry)?,
|
||||
)?,
|
||||
bitfield_distribution: BitfieldDistributionSubsystem::new(
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
bitfield_signing: BitfieldSigningSubsystem::new(
|
||||
spawner.clone(),
|
||||
keystore.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
candidate_backing: CandidateBackingSubsystem::new(
|
||||
spawner.clone(),
|
||||
keystore.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
candidate_selection: CandidateSelectionSubsystem::new(
|
||||
spawner.clone(),
|
||||
(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
candidate_validation: CandidateValidationSubsystem::new(
|
||||
spawner.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
chain_api: ChainApiSubsystem::new(
|
||||
runtime_client.clone(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
collation_generation: CollationGenerationSubsystem::new(
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
collator_protocol: CollatorProtocolSubsystem::new(
|
||||
ProtocolSide::Validator(Metrics::register(registry)?),
|
||||
),
|
||||
network_bridge: NetworkBridgeSubsystem::new(
|
||||
network_service,
|
||||
authority_discovery,
|
||||
),
|
||||
pov_distribution: PoVDistributionSubsystem::new(
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
provisioner: ProvisionerSubsystem::new(
|
||||
spawner.clone(),
|
||||
(),
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
runtime_api: RuntimeApiSubsystem::new(
|
||||
runtime_client,
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
statement_distribution: StatementDistributionSubsystem::new(
|
||||
Metrics::register(registry)?,
|
||||
),
|
||||
};
|
||||
|
||||
Overseer::new(
|
||||
leaves,
|
||||
all_subsystems,
|
||||
prometheus_registry,
|
||||
s,
|
||||
).map_err(|e| ServiceError::Other(format!("Failed to create an Overseer: {:?}", e)))
|
||||
registry,
|
||||
spawner,
|
||||
).map_err(|e| Error::Other(format!("Failed to create an Overseer: {:?}", e)))
|
||||
}
|
||||
|
||||
#[cfg(feature = "full-node")]
|
||||
pub struct NewFull<C> {
|
||||
pub task_manager: TaskManager,
|
||||
pub client: C,
|
||||
pub overseer_handler: OverseerHandler,
|
||||
pub overseer_handler: Option<OverseerHandler>,
|
||||
pub network: Arc<sc_network::NetworkService<Block, <Block as BlockT>::Hash>>,
|
||||
pub network_status_sinks: service::NetworkStatusSinks<Block>,
|
||||
pub rpc_handlers: RpcHandlers,
|
||||
@@ -334,6 +416,24 @@ impl<C> NewFull<C> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Is this node a collator?
|
||||
#[cfg(feature = "full-node")]
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum IsCollator {
|
||||
/// This node is a collator.
|
||||
Yes,
|
||||
/// This node is not a collator.
|
||||
No,
|
||||
}
|
||||
|
||||
#[cfg(feature = "full-node")]
|
||||
impl IsCollator {
|
||||
/// Is this a collator?
|
||||
fn is_collator(&self) -> bool {
|
||||
*self == Self::Yes
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a new full node of arbitrary runtime and executor.
|
||||
///
|
||||
/// This is an advanced feature and not recommended for general use. Generally, `build_full` is
|
||||
@@ -342,6 +442,7 @@ impl<C> NewFull<C> {
|
||||
pub fn new_full<RuntimeApi, Executor>(
|
||||
mut config: Configuration,
|
||||
authority_discovery_disabled: bool,
|
||||
is_collator: IsCollator,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
) -> Result<NewFull<Arc<FullClient<RuntimeApi, Executor>>>, Error>
|
||||
where
|
||||
@@ -392,6 +493,8 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
|
||||
let telemetry_connection_sinks = service::TelemetryConnectionSinks::default();
|
||||
|
||||
let availability_config = config.database.clone().try_into();
|
||||
|
||||
let rpc_handlers = service::spawn_tasks(service::SpawnTasksParams {
|
||||
config,
|
||||
backend: backend.clone(),
|
||||
@@ -428,28 +531,76 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
})
|
||||
.collect();
|
||||
|
||||
let (overseer, overseer_handler) = real_overseer(leaves, prometheus_registry.as_ref(), spawner)?;
|
||||
let overseer_handler_clone = overseer_handler.clone();
|
||||
let authority_discovery_service = if role.is_authority() || is_collator.is_collator() {
|
||||
use sc_network::Event;
|
||||
use futures::StreamExt;
|
||||
|
||||
task_manager.spawn_essential_handle().spawn_blocking("overseer", Box::pin(async move {
|
||||
use futures::{pin_mut, select, FutureExt};
|
||||
|
||||
let forward = polkadot_overseer::forward_events(overseer_client, overseer_handler_clone);
|
||||
|
||||
let forward = forward.fuse();
|
||||
let overseer_fut = overseer.run().fuse();
|
||||
|
||||
pin_mut!(overseer_fut);
|
||||
pin_mut!(forward);
|
||||
|
||||
loop {
|
||||
select! {
|
||||
_ = forward => break,
|
||||
_ = overseer_fut => break,
|
||||
complete => break,
|
||||
}
|
||||
if authority_discovery_disabled {
|
||||
Err("Authority discovery is mandatory for a validator.")?;
|
||||
}
|
||||
}));
|
||||
|
||||
let authority_discovery_role = if role.is_authority() {
|
||||
authority_discovery::Role::PublishAndDiscover(
|
||||
keystore_container.keystore(),
|
||||
)
|
||||
} else {
|
||||
// don't publish our addresses when we're only a collator
|
||||
authority_discovery::Role::Discover
|
||||
};
|
||||
let dht_event_stream = network.event_stream("authority-discovery")
|
||||
.filter_map(|e| async move { match e {
|
||||
Event::Dht(e) => Some(e),
|
||||
_ => None,
|
||||
}});
|
||||
let (worker, service) = authority_discovery::new_worker_and_service(
|
||||
client.clone(),
|
||||
network.clone(),
|
||||
Box::pin(dht_event_stream),
|
||||
authority_discovery_role,
|
||||
prometheus_registry.clone(),
|
||||
);
|
||||
|
||||
task_manager.spawn_handle().spawn("authority-discovery-worker", worker.run());
|
||||
Some(service)
|
||||
} else {
|
||||
None
|
||||
};
|
||||
|
||||
// we'd say let overseer_handler = authority_discovery_service.map(|authority_discovery_service|, ...),
|
||||
// but in that case we couldn't use ? to propagate errors
|
||||
let overseer_handler = if let Some(authority_discovery_service) = authority_discovery_service {
|
||||
let (overseer, overseer_handler) = real_overseer(
|
||||
leaves,
|
||||
keystore_container.sync_keystore(),
|
||||
overseer_client.clone(),
|
||||
availability_config?,
|
||||
network.clone(),
|
||||
authority_discovery_service,
|
||||
prometheus_registry.as_ref(),
|
||||
spawner,
|
||||
)?;
|
||||
let overseer_handler_clone = overseer_handler.clone();
|
||||
|
||||
task_manager.spawn_essential_handle().spawn_blocking("overseer", Box::pin(async move {
|
||||
use futures::{pin_mut, select, FutureExt};
|
||||
|
||||
let forward = polkadot_overseer::forward_events(overseer_client, overseer_handler_clone);
|
||||
|
||||
let forward = forward.fuse();
|
||||
let overseer_fut = overseer.run().fuse();
|
||||
|
||||
pin_mut!(overseer_fut);
|
||||
pin_mut!(forward);
|
||||
|
||||
select! {
|
||||
_ = forward => (),
|
||||
_ = overseer_fut => (),
|
||||
complete => (),
|
||||
}
|
||||
}));
|
||||
|
||||
Some(overseer_handler)
|
||||
} else { None };
|
||||
|
||||
if role.is_authority() {
|
||||
let can_author_with =
|
||||
@@ -459,7 +610,7 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
task_manager.spawn_handle(),
|
||||
client.clone(),
|
||||
transaction_pool,
|
||||
overseer_handler.clone(),
|
||||
overseer_handler.as_ref().ok_or("authorities require real overseer handlers")?.clone(),
|
||||
prometheus_registry.as_ref(),
|
||||
);
|
||||
|
||||
@@ -542,30 +693,6 @@ pub fn new_full<RuntimeApi, Executor>(
|
||||
grandpa::setup_disabled_grandpa(network.clone())?;
|
||||
}
|
||||
|
||||
if role.is_authority() && !authority_discovery_disabled {
|
||||
use sc_network::Event;
|
||||
use futures::StreamExt;
|
||||
|
||||
let authority_discovery_role = authority_discovery::Role::PublishAndDiscover(
|
||||
keystore_container.keystore(),
|
||||
);
|
||||
let dht_event_stream = network.event_stream("authority-discovery")
|
||||
.filter_map(|e| async move { match e {
|
||||
Event::Dht(e) => Some(e),
|
||||
_ => None,
|
||||
}});
|
||||
let (authority_discovery_worker, _service) = authority_discovery::new_worker_and_service(
|
||||
client.clone(),
|
||||
network.clone(),
|
||||
Box::pin(dht_event_stream),
|
||||
authority_discovery_role,
|
||||
prometheus_registry.clone(),
|
||||
);
|
||||
|
||||
task_manager.spawn_handle().spawn("authority-discovery-worker", authority_discovery_worker.run());
|
||||
}
|
||||
|
||||
|
||||
network_starter.start_network();
|
||||
|
||||
Ok(NewFull {
|
||||
@@ -701,7 +828,7 @@ pub fn new_chain_ops(mut config: &mut Configuration) -> Result<
|
||||
consensus_common::import_queue::BasicQueue<Block, PrefixedMemoryDB<BlakeTwo256>>,
|
||||
TaskManager,
|
||||
),
|
||||
ServiceError
|
||||
Error
|
||||
>
|
||||
{
|
||||
config.keystore = service::config::KeystoreConfig::InMemory;
|
||||
@@ -725,7 +852,7 @@ pub fn new_chain_ops(mut config: &mut Configuration) -> Result<
|
||||
}
|
||||
|
||||
/// Build a new light node.
|
||||
pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers), ServiceError> {
|
||||
pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers), Error> {
|
||||
if config.chain_spec.is_rococo() {
|
||||
new_light::<rococo_runtime::RuntimeApi, RococoExecutor>(config)
|
||||
} else if config.chain_spec.is_kusama() {
|
||||
@@ -741,30 +868,35 @@ pub fn build_light(config: Configuration) -> Result<(TaskManager, RpcHandlers),
|
||||
pub fn build_full(
|
||||
config: Configuration,
|
||||
authority_discovery_disabled: bool,
|
||||
is_collator: IsCollator,
|
||||
grandpa_pause: Option<(u32, u32)>,
|
||||
) -> Result<NewFull<Client>, ServiceError> {
|
||||
) -> Result<NewFull<Client>, Error> {
|
||||
if config.chain_spec.is_rococo() {
|
||||
new_full::<rococo_runtime::RuntimeApi, RococoExecutor>(
|
||||
config,
|
||||
authority_discovery_disabled,
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
).map(|full| full.with_client(Client::Rococo))
|
||||
} else if config.chain_spec.is_kusama() {
|
||||
new_full::<kusama_runtime::RuntimeApi, KusamaExecutor>(
|
||||
config,
|
||||
authority_discovery_disabled,
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
).map(|full| full.with_client(Client::Kusama))
|
||||
} else if config.chain_spec.is_westend() {
|
||||
new_full::<westend_runtime::RuntimeApi, WestendExecutor>(
|
||||
config,
|
||||
authority_discovery_disabled,
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
).map(|full| full.with_client(Client::Westend))
|
||||
} else {
|
||||
new_full::<polkadot_runtime::RuntimeApi, PolkadotExecutor>(
|
||||
config,
|
||||
authority_discovery_disabled,
|
||||
is_collator,
|
||||
grandpa_pause,
|
||||
).map(|full| full.with_client(Client::Polkadot))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user