mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 10:31:03 +00:00
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:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -35,6 +35,9 @@ pub enum BridgeHubRuntimeType {
|
|||||||
KusamaLocal,
|
KusamaLocal,
|
||||||
// used by benchmarks
|
// used by benchmarks
|
||||||
KusamaDevelopment,
|
KusamaDevelopment,
|
||||||
|
|
||||||
|
// used with kusama runtime
|
||||||
|
Westend,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl FromStr for BridgeHubRuntimeType {
|
impl FromStr for BridgeHubRuntimeType {
|
||||||
@@ -45,6 +48,7 @@ impl FromStr for BridgeHubRuntimeType {
|
|||||||
kusama::BRIDGE_HUB_KUSAMA => Ok(BridgeHubRuntimeType::Kusama),
|
kusama::BRIDGE_HUB_KUSAMA => Ok(BridgeHubRuntimeType::Kusama),
|
||||||
kusama::BRIDGE_HUB_KUSAMA_LOCAL => Ok(BridgeHubRuntimeType::KusamaLocal),
|
kusama::BRIDGE_HUB_KUSAMA_LOCAL => Ok(BridgeHubRuntimeType::KusamaLocal),
|
||||||
kusama::BRIDGE_HUB_KUSAMA_DEVELOPMENT => Ok(BridgeHubRuntimeType::KusamaDevelopment),
|
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 => Ok(BridgeHubRuntimeType::Rococo),
|
||||||
rococo::BRIDGE_HUB_ROCOCO_LOCAL => Ok(BridgeHubRuntimeType::RococoLocal),
|
rococo::BRIDGE_HUB_ROCOCO_LOCAL => Ok(BridgeHubRuntimeType::RococoLocal),
|
||||||
rococo::BRIDGE_HUB_ROCOCO_DEVELOPMENT => Ok(BridgeHubRuntimeType::RococoDevelopment),
|
rococo::BRIDGE_HUB_ROCOCO_DEVELOPMENT => Ok(BridgeHubRuntimeType::RococoDevelopment),
|
||||||
@@ -64,6 +68,8 @@ impl BridgeHubRuntimeType {
|
|||||||
BridgeHubRuntimeType::KusamaLocal |
|
BridgeHubRuntimeType::KusamaLocal |
|
||||||
BridgeHubRuntimeType::KusamaDevelopment =>
|
BridgeHubRuntimeType::KusamaDevelopment =>
|
||||||
Ok(Box::new(kusama::BridgeHubChainSpec::from_json_file(path)?)),
|
Ok(Box::new(kusama::BridgeHubChainSpec::from_json_file(path)?)),
|
||||||
|
BridgeHubRuntimeType::Westend =>
|
||||||
|
Ok(Box::new(westend::BridgeHubChainSpec::from_json_file(path)?)),
|
||||||
BridgeHubRuntimeType::Rococo |
|
BridgeHubRuntimeType::Rococo |
|
||||||
BridgeHubRuntimeType::RococoLocal |
|
BridgeHubRuntimeType::RococoLocal |
|
||||||
BridgeHubRuntimeType::RococoDevelopment =>
|
BridgeHubRuntimeType::RococoDevelopment =>
|
||||||
@@ -91,6 +97,10 @@ impl BridgeHubRuntimeType {
|
|||||||
"kusama-dev",
|
"kusama-dev",
|
||||||
ParaId::new(1003),
|
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(
|
BridgeHubRuntimeType::Rococo => Ok(Box::new(rococo::live_config(
|
||||||
rococo::BRIDGE_HUB_ROCOCO,
|
rococo::BRIDGE_HUB_ROCOCO,
|
||||||
"Rococo BridgeHub",
|
"Rococo BridgeHub",
|
||||||
@@ -132,6 +142,7 @@ impl BridgeHubRuntimeType {
|
|||||||
BridgeHubRuntimeType::Kusama |
|
BridgeHubRuntimeType::Kusama |
|
||||||
BridgeHubRuntimeType::KusamaLocal |
|
BridgeHubRuntimeType::KusamaLocal |
|
||||||
BridgeHubRuntimeType::KusamaDevelopment => &bridge_hub_kusama_runtime::VERSION,
|
BridgeHubRuntimeType::KusamaDevelopment => &bridge_hub_kusama_runtime::VERSION,
|
||||||
|
BridgeHubRuntimeType::Westend => &bridge_hub_kusama_runtime::VERSION,
|
||||||
BridgeHubRuntimeType::Rococo |
|
BridgeHubRuntimeType::Rococo |
|
||||||
BridgeHubRuntimeType::RococoLocal |
|
BridgeHubRuntimeType::RococoLocal |
|
||||||
BridgeHubRuntimeType::RococoDevelopment |
|
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 {
|
pub mod kusama {
|
||||||
use super::{BridgeHubBalance, ParaId};
|
use super::{BridgeHubBalance, ParaId};
|
||||||
use crate::chain_spec::{
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -492,6 +492,17 @@ macro_rules! construct_async_run {
|
|||||||
{ $( $code )* }.map(|v| (v, task_manager))
|
{ $( $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::Rococo |
|
||||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
|
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
|
||||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => {
|
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment => {
|
||||||
@@ -871,6 +882,13 @@ pub fn run() -> Result<()> {
|
|||||||
>(config, polkadot_config, collator_options, id, hwbench)
|
>(config, polkadot_config, collator_options, id, hwbench)
|
||||||
.await
|
.await
|
||||||
.map(|r| r.0),
|
.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::Rococo |
|
||||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
|
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal |
|
||||||
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment =>
|
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoDevelopment =>
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ usage() {
|
|||||||
echo Usage:
|
echo Usage:
|
||||||
echo "$1 <srtool compressed runtime path>"
|
echo "$1 <srtool compressed runtime path>"
|
||||||
echo "$2 <para_id>"
|
echo "$2 <para_id>"
|
||||||
echo "e.g.: ./scripts/create_bridge_hub_kusama_spec.sh ./target/release/wbuild/bridge-hub-kusama-runtime/bridge_hub_kusama_runtime.compact.compressed.wasm 1003"
|
echo "e.g.: ./scripts/create_bridge_hub_kusama_spec.sh ./target/release/wbuild/bridge-hub-kusama-runtime/bridge_hub_kusama_runtime.compact.compressed.wasm 1002"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -97,7 +97,9 @@ cat chain-spec-plain.json | jq --rawfile code rt-hex.txt '.genesis.runtime.syste
|
|||||||
|
|
||||||
# build a raw spec
|
# build a raw spec
|
||||||
$binary build-spec --chain edited-chain-spec-plain.json --raw > chain-spec-raw.json
|
$binary build-spec --chain edited-chain-spec-plain.json --raw > chain-spec-raw.json
|
||||||
|
cp edited-chain-spec-plain.json bridge-hub-kusama-spec.json
|
||||||
cp chain-spec-raw.json ./parachains/chain-specs/bridge-hub-kusama.json
|
cp chain-spec-raw.json ./parachains/chain-specs/bridge-hub-kusama.json
|
||||||
|
cp chain-spec-raw.json bridge-hub-kusama-spec-raw.json
|
||||||
|
|
||||||
# build genesis data
|
# build genesis data
|
||||||
$binary export-genesis-state --chain chain-spec-raw.json > bridge-hub-kusama-genesis-head-data
|
$binary export-genesis-state --chain chain-spec-raw.json > bridge-hub-kusama-genesis-head-data
|
||||||
|
|||||||
+101
@@ -0,0 +1,101 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo Usage:
|
||||||
|
echo "$1 <srtool compressed runtime path>"
|
||||||
|
echo "$2 <para_id>"
|
||||||
|
echo "e.g.: ./scripts/create_bridge_hub_westend_spec.sh ./target/release/wbuild/bridge-hub-kusama-runtime/bridge_hub_kusama_runtime.compact.compressed.wasm 1002"
|
||||||
|
exit 1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$2" ]; then
|
||||||
|
usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
rt_path=$1
|
||||||
|
para_id=$2
|
||||||
|
|
||||||
|
echo "Generating chain spec for runtime: $rt_path and para_id: $para_id"
|
||||||
|
|
||||||
|
binary="./target/release/polkadot-parachain"
|
||||||
|
|
||||||
|
# build the chain spec we'll manipulate
|
||||||
|
$binary build-spec --chain bridge-hub-kusama-dev > chain-spec-plain.json
|
||||||
|
|
||||||
|
# convert runtime to hex
|
||||||
|
cat $rt_path | od -A n -v -t x1 | tr -d ' \n' > rt-hex.txt
|
||||||
|
|
||||||
|
# replace the runtime in the spec with the given runtime and set some values to production
|
||||||
|
cat chain-spec-plain.json | jq --rawfile code rt-hex.txt '.genesis.runtime.system.code = ("0x" + $code)' \
|
||||||
|
| jq '.name = "Westend BridgeHub"' \
|
||||||
|
| jq '.id = "bridge-hub-westend"' \
|
||||||
|
| jq '.chainType = "Live"' \
|
||||||
|
| jq '.bootNodes = [
|
||||||
|
"/dns/westend-bridge-hub-collator-node-0.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWKyEuqkkWvFSrwZWKWBAsHgLV3HGfHj7yH3LNJLAVhmxY",
|
||||||
|
"/dns/westend-bridge-hub-collator-node-1.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWBpvudthz61XC4oP2YYFFJdhWohBeQ1ffn1BMSGWhapjd",
|
||||||
|
"/dns/westend-bridge-hub-collator-node-2.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWPXqdRRthjKAMPFtaXUK7yBxsvh83QsmzXzALA3inoJfo",
|
||||||
|
"/dns/westend-bridge-hub-collator-node-3.parity-testnet.parity.io/tcp/30333/p2p/12D3KooWAp2YpVaiNBy7rozEHJGocDpaLFt3VFZsGMBEYh4BoEz7"
|
||||||
|
]' \
|
||||||
|
| jq '.relay_chain = "westend"' \
|
||||||
|
| jq '.properties = {
|
||||||
|
"tokenDecimals": 12,
|
||||||
|
"tokenSymbol": "WND"
|
||||||
|
}' \
|
||||||
|
| jq --argjson para_id $para_id '.para_id = $para_id' \
|
||||||
|
| jq --argjson para_id $para_id '.genesis.runtime.parachainInfo.parachainId = $para_id' \
|
||||||
|
| jq '.genesis.runtime.balances.balances = []' \
|
||||||
|
| jq '.genesis.runtime.collatorSelection.invulnerables = [
|
||||||
|
"5GN5qBbUkxigdLhTajWqAG66MRD2v5WjUFqkuGVSRCyhMCg6",
|
||||||
|
"5GRCPWstCyp3u9T2c3oGqj83rniQffJR5Q2LpGsL9m19oQ8T",
|
||||||
|
"5GR2p9FpJFPpDuZPk1Lt9VZJ76aLPfKVA6qBE4FRted2oT6D",
|
||||||
|
"5FH8VBgdXijT1vM6pj1aFGw49J2fQDZKM1BFQtVV1zjmA7mM"
|
||||||
|
]' \
|
||||||
|
| jq '.genesis.runtime.session.keys = [
|
||||||
|
[
|
||||||
|
"5GN5qBbUkxigdLhTajWqAG66MRD2v5WjUFqkuGVSRCyhMCg6",
|
||||||
|
"5GN5qBbUkxigdLhTajWqAG66MRD2v5WjUFqkuGVSRCyhMCg6",
|
||||||
|
{
|
||||||
|
"aura": "5GN5qBbUkxigdLhTajWqAG66MRD2v5WjUFqkuGVSRCyhMCg6"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"5GRCPWstCyp3u9T2c3oGqj83rniQffJR5Q2LpGsL9m19oQ8T",
|
||||||
|
"5GRCPWstCyp3u9T2c3oGqj83rniQffJR5Q2LpGsL9m19oQ8T",
|
||||||
|
{
|
||||||
|
"aura": "5GRCPWstCyp3u9T2c3oGqj83rniQffJR5Q2LpGsL9m19oQ8T"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"5GR2p9FpJFPpDuZPk1Lt9VZJ76aLPfKVA6qBE4FRted2oT6D",
|
||||||
|
"5GR2p9FpJFPpDuZPk1Lt9VZJ76aLPfKVA6qBE4FRted2oT6D",
|
||||||
|
{
|
||||||
|
"aura": "5GR2p9FpJFPpDuZPk1Lt9VZJ76aLPfKVA6qBE4FRted2oT6D"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"5FH8VBgdXijT1vM6pj1aFGw49J2fQDZKM1BFQtVV1zjmA7mM",
|
||||||
|
"5FH8VBgdXijT1vM6pj1aFGw49J2fQDZKM1BFQtVV1zjmA7mM",
|
||||||
|
{
|
||||||
|
"aura": "5FH8VBgdXijT1vM6pj1aFGw49J2fQDZKM1BFQtVV1zjmA7mM"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
]' \
|
||||||
|
> edited-chain-spec-plain.json
|
||||||
|
|
||||||
|
# build a raw spec
|
||||||
|
$binary build-spec --chain edited-chain-spec-plain.json --raw > chain-spec-raw.json
|
||||||
|
cp edited-chain-spec-plain.json bridge-hub-westend-spec.json
|
||||||
|
cp chain-spec-raw.json ./parachains/chain-specs/bridge-hub-westend.json
|
||||||
|
cp chain-spec-raw.json bridge-hub-westend-spec-raw.json
|
||||||
|
|
||||||
|
# build genesis data
|
||||||
|
$binary export-genesis-state --chain chain-spec-raw.json > bridge-hub-westend-genesis-head-data
|
||||||
|
|
||||||
|
# build genesis wasm
|
||||||
|
$binary export-genesis-wasm --chain chain-spec-raw.json > bridge-hub-westend-wasm
|
||||||
Reference in New Issue
Block a user