BHK + BH-Westend release backport (#2083)

* Runtime code according to the released runtime bridge-hub-kusama_runtime-v9360.compact.compressed.wasm

* Add chains spec for westend with generated by `./scripts/create_bridge_hub_westend_spec.sh ~/Downloads/upload/bridge-hub-kusama_runtime-v9360.compact.compressed.wasm 1002`

* fmt
This commit is contained in:
Branislav Kontur
2023-01-13 22:37:22 +01:00
committed by GitHub
parent 8fee8059f3
commit a714040a0d
6 changed files with 219 additions and 3 deletions
@@ -35,6 +35,9 @@ pub enum BridgeHubRuntimeType {
KusamaLocal,
// used by benchmarks
KusamaDevelopment,
// used with kusama runtime
Westend,
}
impl FromStr for BridgeHubRuntimeType {
@@ -45,6 +48,7 @@ impl FromStr for BridgeHubRuntimeType {
kusama::BRIDGE_HUB_KUSAMA => Ok(BridgeHubRuntimeType::Kusama),
kusama::BRIDGE_HUB_KUSAMA_LOCAL => Ok(BridgeHubRuntimeType::KusamaLocal),
kusama::BRIDGE_HUB_KUSAMA_DEVELOPMENT => Ok(BridgeHubRuntimeType::KusamaDevelopment),
westend::BRIDGE_HUB_WESTEND => Ok(BridgeHubRuntimeType::Westend),
rococo::BRIDGE_HUB_ROCOCO => Ok(BridgeHubRuntimeType::Rococo),
rococo::BRIDGE_HUB_ROCOCO_LOCAL => Ok(BridgeHubRuntimeType::RococoLocal),
rococo::BRIDGE_HUB_ROCOCO_DEVELOPMENT => Ok(BridgeHubRuntimeType::RococoDevelopment),
@@ -64,6 +68,8 @@ impl BridgeHubRuntimeType {
BridgeHubRuntimeType::KusamaLocal |
BridgeHubRuntimeType::KusamaDevelopment =>
Ok(Box::new(kusama::BridgeHubChainSpec::from_json_file(path)?)),
BridgeHubRuntimeType::Westend =>
Ok(Box::new(westend::BridgeHubChainSpec::from_json_file(path)?)),
BridgeHubRuntimeType::Rococo |
BridgeHubRuntimeType::RococoLocal |
BridgeHubRuntimeType::RococoDevelopment =>
@@ -91,6 +97,10 @@ impl BridgeHubRuntimeType {
"kusama-dev",
ParaId::new(1003),
))),
BridgeHubRuntimeType::Westend =>
Ok(Box::new(westend::BridgeHubChainSpec::from_json_bytes(
&include_bytes!("../../../parachains/chain-specs/bridge-hub-westend.json")[..],
)?)),
BridgeHubRuntimeType::Rococo => Ok(Box::new(rococo::live_config(
rococo::BRIDGE_HUB_ROCOCO,
"Rococo BridgeHub",
@@ -132,6 +142,7 @@ impl BridgeHubRuntimeType {
BridgeHubRuntimeType::Kusama |
BridgeHubRuntimeType::KusamaLocal |
BridgeHubRuntimeType::KusamaDevelopment => &bridge_hub_kusama_runtime::VERSION,
BridgeHubRuntimeType::Westend => &bridge_hub_kusama_runtime::VERSION,
BridgeHubRuntimeType::Rococo |
BridgeHubRuntimeType::RococoLocal |
BridgeHubRuntimeType::RococoDevelopment |
@@ -373,7 +384,7 @@ pub mod wococo {
}
}
/// Sub-module for Kusama setup (reuses stuff from Rococo)
/// Sub-module for Kusama setup
pub mod kusama {
use super::{BridgeHubBalance, ParaId};
use crate::chain_spec::{
@@ -495,3 +506,12 @@ pub mod kusama {
}
}
}
/// Sub-module for Westend setup (uses Kusama runtime)
pub mod westend {
use crate::chain_spec::bridge_hubs::kusama;
pub(crate) const BRIDGE_HUB_WESTEND: &str = "bridge-hub-westend";
pub type BridgeHubChainSpec = kusama::BridgeHubChainSpec;
pub type RuntimeApi = bridge_hub_kusama_runtime::RuntimeApi;
}
+18
View File
@@ -492,6 +492,17 @@ macro_rules! construct_async_run {
{ $( $code )* }.map(|v| (v, task_manager))
})
},
chain_spec::bridge_hubs::BridgeHubRuntimeType::Westend => {
runner.async_run(|$config| {
let $components = new_partial::<chain_spec::bridge_hubs::westend::RuntimeApi, _>(
&$config,
crate::service::aura_build_import_queue::<_, AuraId>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
},
chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => {
@@ -871,6 +882,13 @@ pub fn run() -> Result<()> {
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0),
chain_spec::bridge_hubs::BridgeHubRuntimeType::Westend =>
crate::service::start_generic_aura_node::<
chain_spec::bridge_hubs::westend::RuntimeApi,
AuraId,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0),
chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment =>