mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 09:21:04 +00:00
Add canvas-kusama runtime (#980)
* Added kanvas runtime * Fix up benchmarking * Fixup markdown stucture * replace :emoji_name: by utf8 * fix up header hierarchy * Merge canvas README * Only use "Canvas" as a name * Remove reference to Rocanvas
This commit is contained in:
committed by
GitHub
parent
81e7db5bc8
commit
230978b683
@@ -18,9 +18,9 @@ use crate::{
|
||||
chain_spec,
|
||||
cli::{Cli, RelayChainCli, Subcommand},
|
||||
service::{
|
||||
new_partial, Block, RococoParachainRuntimeExecutor, SeedlingRuntimeExecutor,
|
||||
ShellRuntimeExecutor, StatemineRuntimeExecutor, StatemintRuntimeExecutor,
|
||||
WestmintRuntimeExecutor,
|
||||
new_partial, Block, CanvasKusamaRuntimeExecutor, RococoParachainRuntimeExecutor,
|
||||
SeedlingRuntimeExecutor, ShellRuntimeExecutor, StatemineRuntimeExecutor,
|
||||
StatemintRuntimeExecutor, WestmintRuntimeExecutor,
|
||||
},
|
||||
};
|
||||
use codec::Encode;
|
||||
@@ -47,6 +47,7 @@ trait IdentifyChain {
|
||||
fn is_statemint(&self) -> bool;
|
||||
fn is_statemine(&self) -> bool;
|
||||
fn is_westmint(&self) -> bool;
|
||||
fn is_canvas_kusama(&self) -> bool;
|
||||
}
|
||||
|
||||
impl IdentifyChain for dyn sc_service::ChainSpec {
|
||||
@@ -65,6 +66,10 @@ impl IdentifyChain for dyn sc_service::ChainSpec {
|
||||
fn is_westmint(&self) -> bool {
|
||||
self.id().starts_with("westmint")
|
||||
}
|
||||
fn is_canvas_kusama(&self) -> bool {
|
||||
// we use the same runtime on rococo and kusama
|
||||
self.id().starts_with("canvas-kusama") || self.id().starts_with("canvas-rococo")
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: sc_service::ChainSpec + 'static> IdentifyChain for T {
|
||||
@@ -83,6 +88,9 @@ impl<T: sc_service::ChainSpec + 'static> IdentifyChain for T {
|
||||
fn is_westmint(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_westmint(self)
|
||||
}
|
||||
fn is_canvas_kusama(&self) -> bool {
|
||||
<dyn sc_service::ChainSpec>::is_canvas_kusama(self)
|
||||
}
|
||||
}
|
||||
|
||||
fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
|
||||
@@ -126,6 +134,10 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
|
||||
"westmint" => Box::new(chain_spec::ChainSpec::from_json_bytes(
|
||||
&include_bytes!("../res/westmint.json")[..],
|
||||
)?),
|
||||
// -- Canvas on Rococo
|
||||
"canvas-rococo-dev" => Box::new(chain_spec::canvas_rococo_development_config()),
|
||||
"canvas-rococo-local" => Box::new(chain_spec::canvas_rococo_local_config()),
|
||||
"canvas-rococo" => Box::new(chain_spec::canvas_rococo_config()),
|
||||
"" => Box::new(chain_spec::get_chain_spec()),
|
||||
path => {
|
||||
let chain_spec = chain_spec::ChainSpec::from_json_file(path.into())?;
|
||||
@@ -139,6 +151,8 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, St
|
||||
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_canvas_kusama() {
|
||||
Box::new(chain_spec::CanvasKusamaChainSpec::from_json_file(path.into())?)
|
||||
} else {
|
||||
Box::new(chain_spec)
|
||||
}
|
||||
@@ -192,6 +206,8 @@ impl SubstrateCli for Cli {
|
||||
&shell_runtime::VERSION
|
||||
} else if chain_spec.is_seedling() {
|
||||
&seedling_runtime::VERSION
|
||||
} else if chain_spec.is_canvas_kusama() {
|
||||
&canvas_kusama_runtime::VERSION
|
||||
} else {
|
||||
&rococo_parachain_runtime::VERSION
|
||||
}
|
||||
@@ -296,6 +312,15 @@ macro_rules! construct_async_run {
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else if runner.config().chain_spec.is_canvas_kusama() {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<canvas_kusama_runtime::RuntimeApi, CanvasKusamaRuntimeExecutor, _>(
|
||||
&$config,
|
||||
crate::service::canvas_kusama_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
} else {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<
|
||||
@@ -542,6 +567,11 @@ pub fn run() -> Result<()> {
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else if config.chain_spec.is_canvas_kusama() {
|
||||
crate::service::start_canvas_kusama_node(config, polkadot_config, id)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into)
|
||||
} else {
|
||||
crate::service::start_rococo_parachain_node(config, polkadot_config, id)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user