mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Split chain_spec to individual chain families (#1347)
* Split chain_spec to individual chain families. * cargo fmt * Replace ifs with match * Runtime::Generic variant avoiding Option
This commit is contained in:
@@ -40,54 +40,51 @@ use sp_core::hexdisplay::HexDisplay;
|
||||
use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
|
||||
use std::{io::Write, net::SocketAddr};
|
||||
|
||||
trait IdentifyChain {
|
||||
fn is_shell(&self) -> bool;
|
||||
fn is_seedling(&self) -> bool;
|
||||
fn is_statemint(&self) -> bool;
|
||||
fn is_statemine(&self) -> bool;
|
||||
fn is_westmint(&self) -> bool;
|
||||
fn is_contracts_rococo(&self) -> bool;
|
||||
enum Runtime {
|
||||
/// This is the default runtime (based on rococo)
|
||||
Generic,
|
||||
Shell,
|
||||
Seedling,
|
||||
Statemint,
|
||||
Statemine,
|
||||
Westmint,
|
||||
ContractsRococo,
|
||||
}
|
||||
|
||||
impl IdentifyChain for dyn sc_service::ChainSpec {
|
||||
fn is_shell(&self) -> bool {
|
||||
self.id().starts_with("shell")
|
||||
}
|
||||
fn is_seedling(&self) -> bool {
|
||||
self.id().starts_with("seedling")
|
||||
}
|
||||
fn is_statemint(&self) -> bool {
|
||||
self.id().starts_with("statemint")
|
||||
}
|
||||
fn is_statemine(&self) -> bool {
|
||||
self.id().starts_with("statemine")
|
||||
}
|
||||
fn is_westmint(&self) -> bool {
|
||||
self.id().starts_with("westmint")
|
||||
}
|
||||
fn is_contracts_rococo(&self) -> bool {
|
||||
self.id().starts_with("contracts-rococo")
|
||||
trait ChainType {
|
||||
fn runtime(&self) -> Runtime;
|
||||
}
|
||||
|
||||
impl ChainType for dyn ChainSpec {
|
||||
fn runtime(&self) -> Runtime {
|
||||
runtime(self.id())
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: sc_service::ChainSpec + 'static> IdentifyChain for T {
|
||||
fn is_shell(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_shell(self)
|
||||
use sc_chain_spec::GenericChainSpec;
|
||||
impl ChainType
|
||||
for GenericChainSpec<rococo_parachain_runtime::GenesisConfig, chain_spec::Extensions>
|
||||
{
|
||||
fn runtime(&self) -> Runtime {
|
||||
runtime(self.id())
|
||||
}
|
||||
fn is_seedling(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_seedling(self)
|
||||
}
|
||||
fn is_statemint(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_statemint(self)
|
||||
}
|
||||
fn is_statemine(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_statemine(self)
|
||||
}
|
||||
fn is_westmint(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_westmint(self)
|
||||
}
|
||||
fn is_contracts_rococo(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_contracts_rococo(self)
|
||||
}
|
||||
|
||||
fn runtime(id: &str) -> Runtime {
|
||||
if id.starts_with("shell") {
|
||||
Runtime::Shell
|
||||
} else if id.starts_with("seedling") {
|
||||
Runtime::Seedling
|
||||
} else if id.starts_with("statemint") {
|
||||
Runtime::Statemint
|
||||
} else if id.starts_with("statemine") {
|
||||
Runtime::Statemine
|
||||
} else if id.starts_with("westmint") {
|
||||
Runtime::Westmint
|
||||
} else if id.starts_with("contracts-rococo") {
|
||||
Runtime::ContractsRococo
|
||||
} else {
|
||||
Runtime::Generic
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,39 +100,41 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
|
||||
"track" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/track.json")[..],
|
||||
)?),
|
||||
"shell" => Box::new(chain_spec::get_shell_chain_spec()),
|
||||
"shell" => Box::new(chain_spec::shell::get_shell_chain_spec()),
|
||||
// -- Statemint
|
||||
"seedling" => Box::new(chain_spec::get_seedling_chain_spec()),
|
||||
"statemint-dev" => Box::new(chain_spec::statemint_development_config()),
|
||||
"statemint-local" => Box::new(chain_spec::statemint_local_config()),
|
||||
"seedling" => Box::new(chain_spec::seedling::get_seedling_chain_spec()),
|
||||
"statemint-dev" => Box::new(chain_spec::statemint::statemint_development_config()),
|
||||
"statemint-local" => Box::new(chain_spec::statemint::statemint_local_config()),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"statemint-genesis" => Box::new(chain_spec::statemint_config()),
|
||||
"statemint-genesis" => Box::new(chain_spec::statemint::statemint_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"statemint" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/statemint.json")[..],
|
||||
)?),
|
||||
// -- Statemine
|
||||
"statemine-dev" => Box::new(chain_spec::statemine_development_config()),
|
||||
"statemine-local" => Box::new(chain_spec::statemine_local_config()),
|
||||
"statemine-dev" => Box::new(chain_spec::statemint::statemine_development_config()),
|
||||
"statemine-local" => Box::new(chain_spec::statemint::statemine_local_config()),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"statemine-genesis" => Box::new(chain_spec::statemine_config()),
|
||||
"statemine-genesis" => Box::new(chain_spec::statemint::statemine_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"statemine" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/statemine.json")[..],
|
||||
)?),
|
||||
// -- Westmint
|
||||
"westmint-dev" => Box::new(chain_spec::westmint_development_config()),
|
||||
"westmint-local" => Box::new(chain_spec::westmint_local_config()),
|
||||
"westmint-dev" => Box::new(chain_spec::statemint::westmint_development_config()),
|
||||
"westmint-local" => Box::new(chain_spec::statemint::westmint_local_config()),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"westmint-genesis" => Box::new(chain_spec::westmint_config()),
|
||||
"westmint-genesis" => Box::new(chain_spec::statemint::westmint_config()),
|
||||
// the shell-based chain spec as used for syncing
|
||||
"westmint" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/westmint.json")[..],
|
||||
)?),
|
||||
// -- Contracts on Rococo
|
||||
"contracts-rococo-dev" => Box::new(chain_spec::contracts_rococo_development_config()),
|
||||
"contracts-rococo-local" => Box::new(chain_spec::contracts_rococo_local_config()),
|
||||
"contracts-rococo-genesis" => Box::new(chain_spec::contracts_rococo_config()),
|
||||
"contracts-rococo-dev" =>
|
||||
Box::new(chain_spec::contracts::contracts_rococo_development_config()),
|
||||
"contracts-rococo-local" =>
|
||||
Box::new(chain_spec::contracts::contracts_rococo_local_config()),
|
||||
"contracts-rococo-genesis" => Box::new(chain_spec::contracts::contracts_rococo_config()),
|
||||
"contracts-rococo" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../../parachains/chain-specs/contracts-rococo.json")[..],
|
||||
)?),
|
||||
@@ -144,20 +143,23 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
|
||||
// -- Loading a specific spec from disk
|
||||
path => {
|
||||
let chain_spec = chain_spec::ChainSpec::from_json_file(path.into())?;
|
||||
if chain_spec.is_statemint() {
|
||||
Box::new(chain_spec::StatemintChainSpec::from_json_file(path.into())?)
|
||||
} else if chain_spec.is_statemine() {
|
||||
Box::new(chain_spec::StatemineChainSpec::from_json_file(path.into())?)
|
||||
} else if chain_spec.is_westmint() {
|
||||
Box::new(chain_spec::WestmintChainSpec::from_json_file(path.into())?)
|
||||
} else if chain_spec.is_shell() {
|
||||
Box::new(chain_spec::ShellChainSpec::from_json_file(path.into())?)
|
||||
} else if chain_spec.is_seedling() {
|
||||
Box::new(chain_spec::SeedlingChainSpec::from_json_file(path.into())?)
|
||||
} else if chain_spec.is_contracts_rococo() {
|
||||
Box::new(chain_spec::ContractsRococoChainSpec::from_json_file(path.into())?)
|
||||
} else {
|
||||
Box::new(chain_spec)
|
||||
match chain_spec.runtime() {
|
||||
Runtime::Statemint => Box::new(
|
||||
chain_spec::statemint::StatemintChainSpec::from_json_file(path.into())?,
|
||||
),
|
||||
Runtime::Statemine => Box::new(
|
||||
chain_spec::statemint::StatemineChainSpec::from_json_file(path.into())?,
|
||||
),
|
||||
Runtime::Westmint =>
|
||||
Box::new(chain_spec::statemint::WestmintChainSpec::from_json_file(path.into())?),
|
||||
Runtime::Shell =>
|
||||
Box::new(chain_spec::shell::ShellChainSpec::from_json_file(path.into())?),
|
||||
Runtime::Seedling =>
|
||||
Box::new(chain_spec::seedling::SeedlingChainSpec::from_json_file(path.into())?),
|
||||
Runtime::ContractsRococo => Box::new(
|
||||
chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path.into())?,
|
||||
),
|
||||
Runtime::Generic => Box::new(chain_spec),
|
||||
}
|
||||
},
|
||||
})
|
||||
@@ -199,20 +201,14 @@ impl SubstrateCli for Cli {
|
||||
}
|
||||
|
||||
fn native_runtime_version(chain_spec: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
|
||||
if chain_spec.is_statemint() {
|
||||
&statemint_runtime::VERSION
|
||||
} else if chain_spec.is_statemine() {
|
||||
&statemine_runtime::VERSION
|
||||
} else if chain_spec.is_westmint() {
|
||||
&westmint_runtime::VERSION
|
||||
} else if chain_spec.is_shell() {
|
||||
&shell_runtime::VERSION
|
||||
} else if chain_spec.is_seedling() {
|
||||
&seedling_runtime::VERSION
|
||||
} else if chain_spec.is_contracts_rococo() {
|
||||
&contracts_rococo_runtime::VERSION
|
||||
} else {
|
||||
&rococo_parachain_runtime::VERSION
|
||||
match chain_spec.runtime() {
|
||||
Runtime::Statemint => &statemint_runtime::VERSION,
|
||||
Runtime::Statemine => &statemine_runtime::VERSION,
|
||||
Runtime::Westmint => &westmint_runtime::VERSION,
|
||||
Runtime::Shell => &shell_runtime::VERSION,
|
||||
Runtime::Seedling => &seedling_runtime::VERSION,
|
||||
Runtime::ContractsRococo => &contracts_rococo_runtime::VERSION,
|
||||
Runtime::Generic => &rococo_parachain_runtime::VERSION,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -270,26 +266,29 @@ fn extract_genesis_wasm(chain_spec: &Box<dyn sc_service::ChainSpec>) -> Result<V
|
||||
/// Creates partial components for the runtimes that are supported by the benchmarks.
|
||||
macro_rules! construct_benchmark_partials {
|
||||
($config:expr, |$partials:ident| $code:expr) => {
|
||||
if $config.chain_spec.is_statemine() {
|
||||
let $partials = new_partial::<statemine_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
} else if $config.chain_spec.is_westmint() {
|
||||
let $partials = new_partial::<westmint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
} else if $config.chain_spec.is_statemint() {
|
||||
let $partials = new_partial::<statemint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, StatemintAuraId>,
|
||||
)?;
|
||||
$code
|
||||
} else {
|
||||
Err("The chain is not supported".into())
|
||||
match $config.chain_spec.runtime() {
|
||||
Runtime::Statemine => {
|
||||
let $partials = new_partial::<statemine_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::Westmint => {
|
||||
let $partials = new_partial::<westmint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::Statemint => {
|
||||
let $partials = new_partial::<statemint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, StatemintAuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
_ => Err("The chain is not supported".into()),
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -297,72 +296,80 @@ macro_rules! construct_benchmark_partials {
|
||||
macro_rules! construct_async_run {
|
||||
(|$components:ident, $cli:ident, $cmd:ident, $config:ident| $( $code:tt )* ) => {{
|
||||
let runner = $cli.create_runner($cmd)?;
|
||||
if runner.config().chain_spec.is_westmint() {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<westmint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_statemine() {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<statemine_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_statemint() {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<statemint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, StatemintAuraId>,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_shell() {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<shell_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::shell_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_seedling() {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<seedling_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::shell_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_contracts_rococo() {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<contracts_rococo_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::contracts_rococo_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<
|
||||
rococo_parachain_runtime::RuntimeApi,
|
||||
_
|
||||
>(
|
||||
&$config,
|
||||
crate::service::rococo_parachain_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
match runner.config().chain_spec.runtime() {
|
||||
Runtime::Westmint => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<westmint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Statemine => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<statemine_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Statemint => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<statemint_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::statemint_build_import_queue::<_, StatemintAuraId>,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Shell => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<shell_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::shell_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Seedling => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<seedling_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::shell_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::ContractsRococo => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<contracts_rococo_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::contracts_rococo_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Generic => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<
|
||||
rococo_parachain_runtime::RuntimeApi,
|
||||
_
|
||||
>(
|
||||
&$config,
|
||||
crate::service::rococo_parachain_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
}
|
||||
}
|
||||
}}
|
||||
}
|
||||
@@ -472,16 +479,13 @@ pub fn run() -> Result<()> {
|
||||
match cmd {
|
||||
BenchmarkCmd::Pallet(cmd) =>
|
||||
if cfg!(feature = "runtime-benchmarks") {
|
||||
runner.sync_run(|config| {
|
||||
if config.chain_spec.is_statemine() {
|
||||
cmd.run::<Block, StatemineRuntimeExecutor>(config)
|
||||
} else if config.chain_spec.is_westmint() {
|
||||
cmd.run::<Block, WestmintRuntimeExecutor>(config)
|
||||
} else if config.chain_spec.is_statemint() {
|
||||
cmd.run::<Block, StatemintRuntimeExecutor>(config)
|
||||
} else {
|
||||
Err("Chain doesn't support benchmarking".into())
|
||||
}
|
||||
runner.sync_run(|config| match config.chain_spec.runtime() {
|
||||
Runtime::Statemine =>
|
||||
cmd.run::<Block, StatemineRuntimeExecutor>(config),
|
||||
Runtime::Westmint => cmd.run::<Block, WestmintRuntimeExecutor>(config),
|
||||
Runtime::Statemint =>
|
||||
cmd.run::<Block, StatemintRuntimeExecutor>(config),
|
||||
_ => Err("Chain doesn't support benchmarking".into()),
|
||||
})
|
||||
} else {
|
||||
Err("Benchmarking wasn't enabled when building the node. \
|
||||
@@ -513,24 +517,20 @@ pub fn run() -> Result<()> {
|
||||
TaskManager::new(runner.config().tokio_handle.clone(), *registry)
|
||||
.map_err(|e| format!("Error: {:?}", e))?;
|
||||
|
||||
if runner.config().chain_spec.is_statemine() {
|
||||
runner.async_run(|config| {
|
||||
match runner.config().chain_spec.runtime() {
|
||||
Runtime::Statemine => runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, StatemineRuntimeExecutor>(config), task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_westmint() {
|
||||
runner.async_run(|config| {
|
||||
}),
|
||||
Runtime::Westmint => runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, WestmintRuntimeExecutor>(config), task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_statemint() {
|
||||
runner.async_run(|config| {
|
||||
}),
|
||||
Runtime::Statemint => runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, StatemintRuntimeExecutor>(config), task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_shell() {
|
||||
runner.async_run(|config| {
|
||||
}),
|
||||
Runtime::Shell => runner.async_run(|config| {
|
||||
Ok((cmd.run::<Block, ShellRuntimeExecutor>(config), task_manager))
|
||||
})
|
||||
} else {
|
||||
Err("Chain doesn't support try-runtime".into())
|
||||
}),
|
||||
_ => Err("Chain doesn't support try-runtime".into()),
|
||||
}
|
||||
} else {
|
||||
Err("Try-runtime must be enabled by `--features try-runtime`.".into())
|
||||
@@ -584,16 +584,46 @@ pub fn run() -> Result<()> {
|
||||
info!("Parachain genesis state: {}", genesis_state);
|
||||
info!("Is collating: {}", if config.role.is_authority() { "yes" } else { "no" });
|
||||
|
||||
if config.chain_spec.is_statemint() {
|
||||
crate::service::start_statemint_node::<
|
||||
match config.chain_spec.runtime() {
|
||||
Runtime::Statemint => crate::service::start_statemint_node::<
|
||||
statemint_runtime::RuntimeApi,
|
||||
StatemintAuraId,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else if config.chain_spec.is_statemine() {
|
||||
crate::service::start_statemint_node::<statemine_runtime::RuntimeApi, AuraId>(
|
||||
.map_err(Into::into),
|
||||
Runtime::Statemine => crate::service::start_statemint_node::<
|
||||
statemine_runtime::RuntimeApi,
|
||||
AuraId,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Westmint => crate::service::start_statemint_node::<
|
||||
westmint_runtime::RuntimeApi,
|
||||
AuraId,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Shell =>
|
||||
crate::service::start_shell_node::<shell_runtime::RuntimeApi>(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
hwbench,
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Seedling => crate::service::start_shell_node::<
|
||||
seedling_runtime::RuntimeApi,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::ContractsRococo => crate::service::start_contracts_rococo_node(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
@@ -602,9 +632,8 @@ pub fn run() -> Result<()> {
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else if config.chain_spec.is_westmint() {
|
||||
crate::service::start_statemint_node::<westmint_runtime::RuntimeApi, AuraId>(
|
||||
.map_err(Into::into),
|
||||
Runtime::Generic => crate::service::start_rococo_parachain_node(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
@@ -613,51 +642,7 @@ pub fn run() -> Result<()> {
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else if config.chain_spec.is_shell() {
|
||||
crate::service::start_shell_node::<shell_runtime::RuntimeApi>(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
hwbench,
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else if config.chain_spec.is_seedling() {
|
||||
crate::service::start_shell_node::<seedling_runtime::RuntimeApi>(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
hwbench,
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else if config.chain_spec.is_contracts_rococo() {
|
||||
crate::service::start_contracts_rococo_node(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
hwbench,
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else {
|
||||
crate::service::start_rococo_parachain_node(
|
||||
config,
|
||||
polkadot_config,
|
||||
collator_options,
|
||||
id,
|
||||
hwbench,
|
||||
)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
.map_err(Into::into),
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user