BridgeHubKusama - initial setup - (chain_spec + basic runtime without any bridging pallets) (#1764)

* [BridgeHub] Setup Rococo backbone parachain

* [BridgeHub] Setup Wococo parachain backbone (reused from Rococo)
[Bridge-Backport] Rebase-fix
BridgeHub] Added zombienet startup tomls for Rococo/Wococo
Fix typo

* [BridgeHub] Added chain_spec for live Rococo/Wococo

* [BridgeHub] Clean bridge-hub-rococo runtime

* [BridgeHub] Add bridge-hub-rococo to CI pipelines

* [BridgeHub] Added bridge-hub-kusama - empty runtime/chain_spec setup

* Fixes

* Fixes for BH

* Fixes for other runtimes - align all

* Fixes - const

* Fixes const

* Fixes

* Fix kusama-local

* Sample zombienet runs

* Fixes

* Fixes for benchmarking

* Fixes CI

* Fixes

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs frame_system

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_collator_selection

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_balances

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_session

* Fixes name

* Fixes readme

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_timestamp

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs cumulus_pallet_xcmp_queue

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_collator_selection

* Fixes

* Fixes

* rustfmt

* Fixes

* Added pallet_utility/pallet_multisig

* Blind try for regex pr-custom-review.yml (added bridge-hub-kusama + collectives-polkadot)

* Fixes

* Fixes

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_utility

* ".git/.scripts/bench-bot.sh" pallet bridge-hub-kusama bridge-hubs pallet_multisig

* Trying to fix sed expression?

* Added license headers + correct "DAG:" desc

Co-authored-by: command-bot <>
This commit is contained in:
Branislav Kontur
2022-12-02 14:06:39 +01:00
committed by GitHub
parent 3b2ec9eade
commit c3df7db394
68 changed files with 5319 additions and 212 deletions
+138 -3
View File
@@ -18,8 +18,9 @@ use crate::{
chain_spec,
cli::{Cli, RelayChainCli, Subcommand},
service::{
new_partial, Block, CollectivesPolkadotRuntimeExecutor, StatemineRuntimeExecutor,
StatemintRuntimeExecutor, WestmintRuntimeExecutor,
new_partial, Block, BridgeHubKusamaRuntimeExecutor, BridgeHubRococoRuntimeExecutor,
CollectivesPolkadotRuntimeExecutor, StatemineRuntimeExecutor, StatemintRuntimeExecutor,
WestmintRuntimeExecutor,
},
};
use codec::Encode;
@@ -53,6 +54,7 @@ enum Runtime {
ContractsRococo,
CollectivesPolkadot,
CollectivesWestend,
BridgeHub(chain_spec::bridge_hubs::BridgeHubRuntimeType),
}
trait RuntimeResolver {
@@ -104,6 +106,11 @@ fn runtime(id: &str) -> Runtime {
Runtime::CollectivesPolkadot
} else if id.starts_with("collectives-westend") {
Runtime::CollectivesWestend
} else if id.starts_with(chain_spec::bridge_hubs::BridgeHubRuntimeType::ID_PREFIX) {
Runtime::BridgeHub(
id.parse::<chain_spec::bridge_hubs::BridgeHubRuntimeType>()
.expect("Invalid value"),
)
} else {
log::warn!("No specific runtime was recognized for ChainSpec's id: '{}', so Runtime::default() will be used", id);
Runtime::default()
@@ -188,6 +195,15 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
&include_bytes!("../../parachains/chain-specs/contracts-rococo.json")[..],
)?),
// -- BridgeHub
bridge_like_id
if bridge_like_id
.starts_with(chain_spec::bridge_hubs::BridgeHubRuntimeType::ID_PREFIX) =>
bridge_like_id
.parse::<chain_spec::bridge_hubs::BridgeHubRuntimeType>()
.expect("invalid value")
.load_config()?,
// -- Penpall
"penpal-kusama" => Box::new(chain_spec::penpal::get_penpal_chain_spec(
para_id.expect("Must specify parachain id"),
@@ -223,6 +239,8 @@ fn load_spec(id: &str) -> std::result::Result<Box<dyn ChainSpec>, String> {
Box::new(chain_spec::seedling::SeedlingChainSpec::from_json_file(path)?),
Runtime::ContractsRococo =>
Box::new(chain_spec::contracts::ContractsRococoChainSpec::from_json_file(path)?),
Runtime::BridgeHub(bridge_hub_runtime_type) =>
bridge_hub_runtime_type.chain_spec_from_json_file(path.into())?,
Runtime::Penpal(_para_id) =>
Box::new(chain_spec::penpal::PenpalChainSpec::from_json_file(path)?),
Runtime::Default => Box::new(
@@ -300,6 +318,8 @@ impl SubstrateCli for Cli {
Runtime::Shell => &shell_runtime::VERSION,
Runtime::Seedling => &seedling_runtime::VERSION,
Runtime::ContractsRococo => &contracts_rococo_runtime::VERSION,
Runtime::BridgeHub(bridge_hub_runtime_type) =>
bridge_hub_runtime_type.runtime_version(),
Runtime::Penpal(_) => &penpal_runtime::VERSION,
Runtime::Default => &rococo_parachain_runtime::VERSION,
}
@@ -457,6 +477,48 @@ macro_rules! construct_async_run {
{ $( $code )* }.map(|v| (v, task_manager))
})
},
Runtime::BridgeHub(bridge_hub_runtime_type) => {
match bridge_hub_runtime_type {
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment => {
runner.async_run(|$config| {
let $components = new_partial::<chain_spec::bridge_hubs::kusama::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 => {
runner.async_run(|$config| {
let $components = new_partial::<chain_spec::bridge_hubs::rococo::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::Wococo |
chain_spec::bridge_hubs::BridgeHubRuntimeType::WococoLocal => {
runner.async_run(|$config| {
let $components = new_partial::<chain_spec::bridge_hubs::wococo::RuntimeApi, _>(
&$config,
crate::service::aura_build_import_queue::<_, AuraId>,
)?;
let task_manager = $components.task_manager;
{ $( $code )* }.map(|v| (v, task_manager))
})
}
}
},
Runtime::Penpal(_) | Runtime::Default => {
runner.async_run(|$config| {
let $components = new_partial::<
@@ -547,7 +609,8 @@ pub fn run() -> Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| match config.chain_spec.runtime() {
runner.sync_run(|config| {
match config.chain_spec.runtime() {
Runtime::Statemine =>
cmd.run::<Block, StatemineRuntimeExecutor>(config),
Runtime::Westmint => cmd.run::<Block, WestmintRuntimeExecutor>(config),
@@ -555,11 +618,28 @@ pub fn run() -> Result<()> {
cmd.run::<Block, StatemintRuntimeExecutor>(config),
Runtime::CollectivesPolkadot | Runtime::CollectivesWestend =>
cmd.run::<Block, CollectivesPolkadotRuntimeExecutor>(config),
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment =>
cmd.run::<Block, BridgeHubKusamaRuntimeExecutor>(config),
chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment =>
cmd.run::<Block, BridgeHubRococoRuntimeExecutor>(config),
_ => Err(format!(
"Chain '{:?}' doesn't support benchmarking for bridge_hub_runtime_type: {:?}",
config.chain_spec.runtime(),
bridge_hub_runtime_type
)
.into()),
}
_ => Err(format!(
"Chain '{:?}' doesn't support benchmarking",
config.chain_spec.runtime()
)
.into()),
}
})
} else {
Err("Benchmarking wasn't enabled when building the node. \
@@ -620,6 +700,32 @@ pub fn run() -> Result<()> {
task_manager,
))
}),
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment =>
runner.async_run(|config| {
Ok((
cmd.run::<Block, BridgeHubKusamaRuntimeExecutor>(config),
task_manager,
))
}),
chain_spec::bridge_hubs::BridgeHubRuntimeType::Rococo |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment =>
runner.async_run(|config| {
Ok((
cmd.run::<Block, BridgeHubRococoRuntimeExecutor>(config),
task_manager,
))
}),
_ => Err(format!(
"Chain '{:?}' doesn't support try-runtime for bridge_hub_runtime_type: {:?}",
runner.config().chain_spec.runtime(),
bridge_hub_runtime_type
)
.into()),
},
Runtime::Shell => runner.async_run(|config| {
Ok((
cmd.run::<Block, crate::service::ShellRuntimeExecutor>(config),
@@ -746,6 +852,35 @@ pub fn run() -> Result<()> {
.await
.map(|r| r.0)
.map_err(Into::into),
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaDevelopment =>
crate::service::start_generic_aura_node::<
chain_spec::bridge_hubs::kusama::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 =>
crate::service::start_generic_aura_node::<
chain_spec::bridge_hubs::rococo::RuntimeApi,
AuraId,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0),
chain_spec::bridge_hubs::BridgeHubRuntimeType::Wococo |
chain_spec::bridge_hubs::BridgeHubRuntimeType::WococoLocal =>
crate::service::start_generic_aura_node::<
chain_spec::bridge_hubs::wococo::RuntimeApi,
AuraId,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0),
}
.map_err(Into::into),
Runtime::Penpal(_) | Runtime::Default =>
crate::service::start_rococo_parachain_node(
config,