mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 21:31:02 +00:00
Add collectives-westend and glutton-westend runtimes (#2024)
Add collectives and glutton parachain westend runtimes to prepare for #1737. The removal of system parachain native runtimes #1737 is blocked until chainspecs and runtime APIs can be dealt with cleanly (merge of #1256 and follow up PRs). In the meantime, these additions are ready to be merged to `master`, so I have separated them out into this PR. Also marked `bridge-hub-westend` as unimplemented in line with [this issue](https://github.com/paritytech/parity-bridges-common/issues/2602). TODO - [x] add to `command-bot` benchmarks - [x] add to `command-bot-scripts` benchmarks - [x] generate weights --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Muharem <ismailov.m.h@gmail.com> Co-authored-by: command-bot <> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: Branislav Kontur <bkontur@gmail.com>
This commit is contained in:
@@ -50,6 +50,7 @@ enum Runtime {
|
||||
CollectivesPolkadot,
|
||||
CollectivesWestend,
|
||||
Glutton,
|
||||
GluttonWestend,
|
||||
BridgeHub(chain_spec::bridge_hubs::BridgeHubRuntimeType),
|
||||
}
|
||||
|
||||
@@ -111,6 +112,8 @@ fn runtime(id: &str) -> Runtime {
|
||||
id.parse::<chain_spec::bridge_hubs::BridgeHubRuntimeType>()
|
||||
.expect("Invalid value"),
|
||||
)
|
||||
} else if id.starts_with("glutton-westend") {
|
||||
Runtime::GluttonWestend
|
||||
} else if id.starts_with("glutton") {
|
||||
Runtime::Glutton
|
||||
} else {
|
||||
@@ -219,8 +222,12 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/collectives-polkadot.json")[..],
|
||||
)?),
|
||||
"collectives-westend-dev" =>
|
||||
Box::new(chain_spec::collectives::collectives_westend_development_config()),
|
||||
"collectives-westend-local" =>
|
||||
Box::new(chain_spec::collectives::collectives_westend_local_config()),
|
||||
"collectives-westend" =>
|
||||
Box::new(chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_bytes(
|
||||
Box::new(chain_spec::collectives::CollectivesWestendChainSpec::from_json_bytes(
|
||||
&include_bytes!("../chain-specs/collectives-westend.json")[..],
|
||||
)?),
|
||||
|
||||
@@ -254,6 +261,18 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
"polkadot-local",
|
||||
)),
|
||||
|
||||
// -- Glutton Westend
|
||||
"glutton-westend-dev" => Box::new(chain_spec::glutton::glutton_westend_development_config(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
)),
|
||||
"glutton-westend-local" => Box::new(chain_spec::glutton::glutton_westend_local_config(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
)),
|
||||
// the chain spec as used for generating the upgrade genesis values
|
||||
"glutton-westend-genesis" => Box::new(chain_spec::glutton::glutton_westend_config(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
)),
|
||||
|
||||
// -- Glutton
|
||||
"glutton-kusama-dev" => Box::new(chain_spec::glutton::glutton_development_config(
|
||||
para_id.expect("Must specify parachain id"),
|
||||
@@ -288,9 +307,12 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
Runtime::AssetHubWestend => Box::new(
|
||||
chain_spec::asset_hubs::AssetHubWestendChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => Box::new(
|
||||
Runtime::CollectivesPolkadot => Box::new(
|
||||
chain_spec::collectives::CollectivesPolkadotChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::CollectivesWestend => Box::new(
|
||||
chain_spec::collectives::CollectivesWestendChainSpec::from_json_file(path)?,
|
||||
),
|
||||
Runtime::Shell =>
|
||||
Box::new(chain_spec::shell::ShellChainSpec::from_json_file(path)?),
|
||||
Runtime::Seedling =>
|
||||
@@ -301,6 +323,8 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
|
||||
bridge_hub_runtime_type.chain_spec_from_json_file(path)?,
|
||||
Runtime::Penpal(_para_id) =>
|
||||
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
|
||||
Runtime::GluttonWestend =>
|
||||
Box::new(chain_spec::glutton::GluttonChainSpec::from_json_file(path)?),
|
||||
Runtime::Glutton =>
|
||||
Box::new(chain_spec::glutton::GluttonChainSpec::from_json_file(path)?),
|
||||
Runtime::Default => Box::new(
|
||||
@@ -322,6 +346,10 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option<ParaId>) {
|
||||
const GLUTTON_PARA_LOCAL_PREFIX: &str = "glutton-kusama-local-";
|
||||
const GLUTTON_PARA_GENESIS_PREFIX: &str = "glutton-kusama-genesis-";
|
||||
|
||||
const GLUTTON_WESTEND_PARA_DEV_PREFIX: &str = "glutton-westend-dev-";
|
||||
const GLUTTON_WESTEND_PARA_LOCAL_PREFIX: &str = "glutton-westend-local-";
|
||||
const GLUTTON_WESTEND_PARA_GENESIS_PREFIX: &str = "glutton-westend-genesis-";
|
||||
|
||||
let (norm_id, orig_id, para) = if let Some(suffix) = id.strip_prefix(KUSAMA_TEST_PARA_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..KUSAMA_TEST_PARA_PREFIX.len() - 1], id, Some(para_id))
|
||||
@@ -337,6 +365,15 @@ fn extract_parachain_id(id: &str) -> (&str, &str, Option<ParaId>) {
|
||||
} else if let Some(suffix) = id.strip_prefix(GLUTTON_PARA_GENESIS_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..GLUTTON_PARA_GENESIS_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if let Some(suffix) = id.strip_prefix(GLUTTON_WESTEND_PARA_DEV_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..GLUTTON_WESTEND_PARA_DEV_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if let Some(suffix) = id.strip_prefix(GLUTTON_WESTEND_PARA_LOCAL_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..GLUTTON_WESTEND_PARA_LOCAL_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else if let Some(suffix) = id.strip_prefix(GLUTTON_WESTEND_PARA_GENESIS_PREFIX) {
|
||||
let para_id: u32 = suffix.parse().expect("Invalid parachain-id suffix");
|
||||
(&id[..GLUTTON_WESTEND_PARA_GENESIS_PREFIX.len() - 1], id, Some(para_id))
|
||||
} else {
|
||||
(id, id, None)
|
||||
};
|
||||
@@ -494,13 +531,20 @@ macro_rules! construct_partials {
|
||||
$code
|
||||
},
|
||||
},
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => {
|
||||
Runtime::CollectivesPolkadot => {
|
||||
let $partials = new_partial::<collectives_polkadot_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::CollectivesWestend => {
|
||||
let $partials = new_partial::<collectives_westend_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::Shell => {
|
||||
let $partials = new_partial::<shell_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
@@ -529,6 +573,13 @@ macro_rules! construct_partials {
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::GluttonWestend => {
|
||||
let $partials = new_partial::<glutton_westend_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::shell_build_import_queue,
|
||||
)?;
|
||||
$code
|
||||
},
|
||||
Runtime::Glutton => {
|
||||
let $partials = new_partial::<glutton_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
@@ -584,7 +635,7 @@ macro_rules! construct_async_run {
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend => {
|
||||
Runtime::CollectivesPolkadot => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<collectives_polkadot_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
@@ -594,6 +645,16 @@ macro_rules! construct_async_run {
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::CollectivesWestend => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<collectives_westend_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::aura_build_import_queue::<_, AuraId>,
|
||||
)?;
|
||||
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, _>(
|
||||
@@ -705,6 +766,16 @@ macro_rules! construct_async_run {
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::GluttonWestend => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<glutton_westend_runtime::RuntimeApi, _>(
|
||||
&$config,
|
||||
crate::service::shell_build_import_queue,
|
||||
)?;
|
||||
let task_manager = $components.task_manager;
|
||||
{ $( $code )* }.map(|v| (v, task_manager))
|
||||
})
|
||||
},
|
||||
Runtime::Glutton => {
|
||||
runner.async_run(|$config| {
|
||||
let $components = new_partial::<glutton_runtime::RuntimeApi, _>(
|
||||
@@ -836,7 +907,7 @@ pub fn run() -> Result<()> {
|
||||
// that both file paths exist, the node will exit, as the user must decide (by
|
||||
// deleting one path) the information that they want to use as their DB.
|
||||
let old_name = match config.chain_spec.id() {
|
||||
"asset-hub-polkadot" => Some("statemint"),
|
||||
"asset-hub-polkadot" => Some("statemint"),
|
||||
"asset-hub-kusama" => Some("statemine"),
|
||||
"asset-hub-westend" => Some("westmint"),
|
||||
"asset-hub-rococo" => Some("rockmine"),
|
||||
@@ -921,7 +992,7 @@ pub fn run() -> Result<()> {
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
|
||||
Runtime::CollectivesPolkadot =>
|
||||
crate::service::start_generic_aura_node::<
|
||||
collectives_polkadot_runtime::RuntimeApi,
|
||||
AuraId,
|
||||
@@ -929,6 +1000,14 @@ pub fn run() -> Result<()> {
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::CollectivesWestend =>
|
||||
crate::service::start_generic_aura_node::<
|
||||
collectives_westend_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,
|
||||
@@ -962,7 +1041,7 @@ pub fn run() -> Result<()> {
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::Polkadot |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotLocal |
|
||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::PolkadotDevelopment =>
|
||||
crate::service::start_generic_aura_node::<
|
||||
@@ -1019,6 +1098,14 @@ pub fn run() -> Result<()> {
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::GluttonWestend =>
|
||||
crate::service::start_basic_lookahead_node::<
|
||||
glutton_westend_runtime::RuntimeApi,
|
||||
AuraId,
|
||||
>(config, polkadot_config, collator_options, id, hwbench)
|
||||
.await
|
||||
.map(|r| r.0)
|
||||
.map_err(Into::into),
|
||||
Runtime::Glutton =>
|
||||
crate::service::start_basic_lookahead_node::<
|
||||
glutton_runtime::RuntimeApi,
|
||||
|
||||
Reference in New Issue
Block a user