[BridgeHub] Setup Wococo parachain backbone (reused from Rococo)

[Bridge-Backport] Rebase-fix
BridgeHub] Added zombienet startup tomls for Rococo/Wococo
Fix typo
This commit is contained in:
Branislav Kontur
2022-08-05 10:57:12 +02:00
parent 2def98a1ef
commit b9cd3a8f57
8 changed files with 204 additions and 42 deletions
Generated
+11
View File
@@ -1024,6 +1024,7 @@ dependencies = [
"pallet-transaction-payment-rpc-runtime-api", "pallet-transaction-payment-rpc-runtime-api",
"pallet-xcm", "pallet-xcm",
"parachain-info", "parachain-info",
"parachains-common",
"parity-scale-codec", "parity-scale-codec",
"polkadot-parachain 0.9.27", "polkadot-parachain 0.9.27",
"polkadot-runtime-common", "polkadot-runtime-common",
@@ -9923,6 +9924,7 @@ dependencies = [
"sc-allocator", "sc-allocator",
"sp-maybe-compressed-blob", "sp-maybe-compressed-blob",
"sp-sandbox", "sp-sandbox",
"sp-serializer 4.0.0-dev (git+https://github.com/paritytech//substrate?branch=sv-locked-for-gav-xcm-v3-and-bridges)",
"sp-wasm-interface", "sp-wasm-interface",
"thiserror", "thiserror",
"wasm-instrument", "wasm-instrument",
@@ -11634,6 +11636,15 @@ dependencies = [
"serde_json", "serde_json",
] ]
[[package]]
name = "sp-serializer"
version = "4.0.0-dev"
source = "git+https://github.com/paritytech//substrate?branch=sv-locked-for-gav-xcm-v3-and-bridges#aa7520bd0a2094204a6c0b33865aa264e6d686a5"
dependencies = [
"serde",
"serde_json",
]
[[package]] [[package]]
name = "sp-session" name = "sp-session"
version = "4.0.0-dev" version = "4.0.0-dev"
+55 -18
View File
@@ -19,7 +19,7 @@ Every _BridgeHub_ is meant to be **_common good parachain_** with main responsib
### Deploy ### Deploy
``` ```
cd <cumulus-git-repo-dir> cd <cumulus-git-repo-dir>
cargo build --release --locked -p polkadot-parachain@0.9.220 cargo build --release --locked -p polkadot-parachain@0.9.230
mkdir -p ~/local_bridge_testing/bin mkdir -p ~/local_bridge_testing/bin
@@ -28,41 +28,78 @@ cp target/release/polkadot-parachain ~/local_bridge_testing/bin/polkadot-paracha
ls -lrt ~/local_bridge_testing/bin/polkadot-parachain ls -lrt ~/local_bridge_testing/bin/polkadot-parachain
``` ```
### Run relay chain (Rococo) ### Run with Zombienet
```
# Rococo
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet_tests/0004-run_bridge_hubs_rococo.toml
# Wococo
POLKADOT_BINARY_PATH=~/local_bridge_testing/bin/polkadot \
POLKADOT_PARACHAIN_BINARY_PATH=~/local_bridge_testing/bin/polkadot-parachain \
~/local_bridge_testing/bin/zombienet-linux --provider native spawn ./zombienet_tests/0004-run_bridge_hubs_wococo.toml
```
### Run from cmd
#### Run relay chains (Rococo, Wococo)
``` ```
<build polkadot repo at first and copy binary to ~/local_bridge_testing/bin/ > <build polkadot repo at first and copy binary to ~/local_bridge_testing/bin/ >
# Rococo
~/local_bridge_testing/bin/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > ~/local_bridge_testing/rococo-local-cfde.json ~/local_bridge_testing/bin/polkadot build-spec --chain rococo-local --disable-default-bootnode --raw > ~/local_bridge_testing/rococo-local-cfde.json
~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/rococo-local-cfde.json --alice --tmp ~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/rococo-local-cfde.json --alice --tmp --port 30332 --rpc-port 9932 --ws-port 9942
~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/rococo-local-cfde.json --bob --tmp --port 30334 ~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/rococo-local-cfde.json --bob --tmp --port 30333 --rpc-port 9933 --ws-port 9943
``` ~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/rococo-local-cfde.json --charlie --tmp --port 30334 --rpc-port 9934 --ws-port 9944
### Run Rococo BridgeHub parachain # Wococo
#### Generate spec + genesis + wasm (paraId=1013) ~/local_bridge_testing/bin/polkadot build-spec --chain wococo-local --disable-default-bootnode --raw > ~/local_bridge_testing/wococo-local-cfde.json
~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/wococo-local-cfde.json --alice --tmp --port 30335 --rpc-port 9935 --ws-port 9945
~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/wococo-local-cfde.json --bob --tmp --port 30336 --rpc-port 9936 --ws-port 9946
~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/wococo-local-cfde.json --charlie --tmp --port 30337 --rpc-port 9937 --ws-port 9947
~/local_bridge_testing/bin/polkadot --chain ~/local_bridge_testing/wococo-local-cfde.json --dave --tmp --port 30338 --rpc-port 9938 --ws-port 9948
``` ```
We need at least 5 nodes together (validator + collator) to finalize blocks.
#### Run BridgeHub parachains (Rococo, Wococo)
##### Generate spec + genesis + wasm (paraId=1013)
```
# Rococo
rm ~/local_bridge_testing/bridge-hub-rococo-local-raw.json rm ~/local_bridge_testing/bridge-hub-rococo-local-raw.json
~/local_bridge_testing/bin/polkadot-parachain build-spec --chain bridge-hub-rococo-local --raw --disable-default-bootnode > ~/local_bridge_testing/bridge-hub-rococo-local-raw.json ~/local_bridge_testing/bin/polkadot-parachain build-spec --chain bridge-hub-rococo-local --raw --disable-default-bootnode > ~/local_bridge_testing/bridge-hub-rococo-local-raw.json
~/local_bridge_testing/bin/polkadot-parachain export-genesis-state --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json > ~/local_bridge_testing/bridge-hub-rococo-local-genesis ~/local_bridge_testing/bin/polkadot-parachain export-genesis-state --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json > ~/local_bridge_testing/bridge-hub-rococo-local-genesis
~/local_bridge_testing/bin/polkadot-parachain export-genesis-wasm --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json > ~/local_bridge_testing/bridge-hub-rococo-local-genesis-wasm ~/local_bridge_testing/bin/polkadot-parachain export-genesis-wasm --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json > ~/local_bridge_testing/bridge-hub-rococo-local-genesis-wasm
# Wococo
rm ~/local_bridge_testing/bridge-hub-wococo-local-raw.json
~/local_bridge_testing/bin/polkadot-parachain build-spec --chain bridge-hub-wococo-local --raw --disable-default-bootnode > ~/local_bridge_testing/bridge-hub-wococo-local-raw.json
~/local_bridge_testing/bin/polkadot-parachain export-genesis-state --chain ~/local_bridge_testing/bridge-hub-wococo-local-raw.json > ~/local_bridge_testing/bridge-hub-wococo-local-genesis
~/local_bridge_testing/bin/polkadot-parachain export-genesis-wasm --chain ~/local_bridge_testing/bridge-hub-wococo-local-raw.json > ~/local_bridge_testing/bridge-hub-wococo-local-genesis-wasm
``` ```
#### Run collators ##### Run collators (Rococo, Wococo)
``` ```
~/local_bridge_testing/bin/polkadot-parachain --collator --alice --force-authoring --tmp --port 40335 --ws-port 9946 --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json -- --execution wasm --chain ~/local_bridge_testing/rococo-local-cfde.json --port 30335 # Rococo
~/local_bridge_testing/bin/polkadot-parachain --collator --bob --force-authoring --tmp --port 40336 --ws-port 9947 --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json -- --execution wasm --chain ~/local_bridge_testing/rococo-local-cfde.json --port 30336 ~/local_bridge_testing/bin/polkadot-parachain --collator --alice --force-authoring --tmp --port 40333 --rpc-port 8933 --ws-port 8943 --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json -- --execution wasm --chain ~/local_bridge_testing/rococo-local-cfde.json --port 41333 --rpc-port 48933 --ws-port 48943
~/local_bridge_testing/bin/polkadot-parachain --collator --bob --force-authoring --tmp --port 40334 --rpc-port 8934 --ws-port 8944 --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json -- --execution wasm --chain ~/local_bridge_testing/rococo-local-cfde.json --port 41334 -rpc-port 48934 --ws-port 48944
# Wococo
~/local_bridge_testing/bin/polkadot-parachain --collator --alice --force-authoring --tmp --port 40335 --rpc-port 8935 --ws-port 8945 --chain ~/local_bridge_testing/bridge-hub-wococo-local-raw.json -- --execution wasm --chain ~/local_bridge_testing/wococo-local-cfde.json --port 41335 --rpc-port 48935 --ws-port 48945
~/local_bridge_testing/bin/polkadot-parachain --collator --bob --force-authoring --tmp --port 40336 --rpc-port 8936 --ws-port 8946 --chain ~/local_bridge_testing/bridge-hub-wococo-local-raw.json -- --execution wasm --chain ~/local_bridge_testing/wococo-local-cfde.json --port 41336 --rpc-port 48936 --ws-port 48946
``` ```
#### Run parachain node ##### Activate parachains (Rococo, Wococo) (paraId=1013)
``` ```
~/local_bridge_testing/bin/polkadot-parachain --tmp --port 40337 --ws-port 9948 --chain ~/local_bridge_testing/bridge-hub-rococo-local-raw.json -- --execution wasm --chain ~/local_bridge_testing/rococo-local-cfde.json --port 30337 # Rococo
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9942#/explorer
# Wococo
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9945#/explorer
``` ```
#### Activate parachain (paraId=1013) ##### After parachain activation, we should see new blocks in collator's node
```
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer
```
#### After parachain activation, we should see new blocks in collator's node
``` ```
https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/parachains
``` ```
@@ -65,6 +65,7 @@ cumulus-primitives-timestamp = { path = "../../../../primitives/timestamp", defa
cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false } cumulus-primitives-utility = { path = "../../../../primitives/utility", default-features = false }
pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false } pallet-collator-selection = { path = "../../../../pallets/collator-selection", default-features = false }
parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false } parachain-info = { path = "../../../../parachains/pallets/parachain-info", default-features = false }
parachains-common = { path = "../../../../parachains/common", default-features = false }
# Bridges # Bridges
bp-polkadot-core = { path = "../../../../bridges/primitives/polkadot-core", default-features = false } bp-polkadot-core = { path = "../../../../bridges/primitives/polkadot-core", default-features = false }
@@ -31,9 +31,9 @@ use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, OpaqueMetadata}; use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_runtime::{ use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys, create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, IdentifyAccount, Verify}, traits::{AccountIdLookup, BlakeTwo256, Block as BlockT},
transaction_validity::{TransactionSource, TransactionValidity}, transaction_validity::{TransactionSource, TransactionValidity},
ApplyExtrinsicResult, MultiSignature, ApplyExtrinsicResult,
}; };
use sp_std::prelude::*; use sp_std::prelude::*;
@@ -43,14 +43,13 @@ use sp_version::RuntimeVersion;
use frame_support::{ use frame_support::{
construct_runtime, parameter_types, construct_runtime, parameter_types,
traits::Everything, traits::{Everything, IsInVec},
weights::{ weights::{
constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight, constants::WEIGHT_PER_SECOND, ConstantMultiplier, DispatchClass, Weight,
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial, WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
}, },
PalletId, PalletId,
}; };
use frame_support::traits::IsInVec;
use frame_system::{ use frame_system::{
limits::{BlockLength, BlockWeights}, limits::{BlockLength, BlockWeights},
EnsureRoot, EnsureRoot,
@@ -70,16 +69,10 @@ use polkadot_runtime_common::{BlockHashCount, SlowAdjustingFeeUpdate};
use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight}; use weights::{BlockExecutionWeight, ExtrinsicBaseWeight, RocksDbWeight};
// XCM Imports // XCM Imports
use parachains_common::{AccountId, Signature};
use xcm::latest::prelude::BodyId; use xcm::latest::prelude::BodyId;
use xcm_executor::XcmExecutor; use xcm_executor::XcmExecutor;
/// Alias to 512-bit hash when used in the context of a transaction signature on the chain.
pub type Signature = MultiSignature;
/// Some way of identifying an account on the chain. We intentionally make it equivalent
/// to the public key of our transaction signing scheme.
pub type AccountId = <<Signature as Verify>::Signer as IdentifyAccount>::AccountId;
/// Balance of an account. /// Balance of an account.
pub type Balance = u128; pub type Balance = u128;
@@ -489,7 +482,7 @@ impl pallet_bridge_grandpa::Config<BridgeGrandpaWococoInstance> for Runtime {
type WeightInfo = (); type WeightInfo = ();
} }
/// Add granda bridge pallet to track Wococo relay chain /// Add granda bridge pallet to track Rococo relay chain
pub type BridgeGrandpaRococoInstance = pallet_bridge_grandpa::Instance2; pub type BridgeGrandpaRococoInstance = pallet_bridge_grandpa::Instance2;
impl pallet_bridge_grandpa::Config<BridgeGrandpaRococoInstance> for Runtime { impl pallet_bridge_grandpa::Config<BridgeGrandpaRococoInstance> for Runtime {
type BridgedChain = bp_rococo::Rococo; type BridgedChain = bp_rococo::Rococo;
@@ -512,7 +505,7 @@ pub type BridgeParachainWococoInstance = pallet_bridge_parachains::Instance1;
impl pallet_bridge_parachains::Config<BridgeParachainWococoInstance> for Runtime { impl pallet_bridge_parachains::Config<BridgeParachainWococoInstance> for Runtime {
type WeightInfo = (); type WeightInfo = ();
type BridgesGrandpaPalletInstance = BridgeGrandpaWococoInstance; type BridgesGrandpaPalletInstance = BridgeGrandpaWococoInstance;
type ParasPalletName = RococoBridgeParachainPalletName; type ParasPalletName = WococoBridgeParachainPalletName;
type TrackedParachains = IsInVec<GetTenFirstParachains>; type TrackedParachains = IsInVec<GetTenFirstParachains>;
type HeadsToKeep = ParachainHeadsToKeep; type HeadsToKeep = ParachainHeadsToKeep;
} }
@@ -522,7 +515,7 @@ pub type BridgeParachainRococoInstance = pallet_bridge_parachains::Instance2;
impl pallet_bridge_parachains::Config<BridgeParachainRococoInstance> for Runtime { impl pallet_bridge_parachains::Config<BridgeParachainRococoInstance> for Runtime {
type WeightInfo = (); type WeightInfo = ();
type BridgesGrandpaPalletInstance = BridgeGrandpaRococoInstance; type BridgesGrandpaPalletInstance = BridgeGrandpaRococoInstance;
type ParasPalletName = WococoBridgeParachainPalletName; type ParasPalletName = RococoBridgeParachainPalletName;
type TrackedParachains = IsInVec<GetTenFirstParachains>; type TrackedParachains = IsInVec<GetTenFirstParachains>;
type HeadsToKeep = ParachainHeadsToKeep; type HeadsToKeep = ParachainHeadsToKeep;
} }
@@ -14,14 +14,16 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Cumulus. If not, see <http://www.gnu.org/licenses/>. // along with Cumulus. If not, see <http://www.gnu.org/licenses/>.
use polkadot_service::ParaId; use cumulus_primitives_core::ParaId;
use sc_chain_spec::ChainSpec; use sc_chain_spec::ChainSpec;
use sc_cli::RuntimeVersion; use sc_cli::RuntimeVersion;
use std::{path::PathBuf, str::FromStr}; use std::{path::PathBuf, str::FromStr};
/// Collects all supported BridgeHub configurations /// Collects all supported BridgeHub configurations
#[derive(Debug, PartialEq)]
pub enum BridgeHubRuntimeType { pub enum BridgeHubRuntimeType {
RococoLocal, RococoLocal,
WococoLocal,
} }
impl FromStr for BridgeHubRuntimeType { impl FromStr for BridgeHubRuntimeType {
@@ -30,6 +32,7 @@ impl FromStr for BridgeHubRuntimeType {
fn from_str(value: &str) -> Result<Self, Self::Err> { fn from_str(value: &str) -> Result<Self, Self::Err> {
match value { match value {
rococo::BRIDGE_HUB_ROCOCO_LOCAL => Ok(BridgeHubRuntimeType::RococoLocal), rococo::BRIDGE_HUB_ROCOCO_LOCAL => Ok(BridgeHubRuntimeType::RococoLocal),
wococo::BRIDGE_HUB_WOCOCO_LOCAL => Ok(BridgeHubRuntimeType::WococoLocal),
_ => Err(format!("Value '{}' is not configured yet", value)), _ => Err(format!("Value '{}' is not configured yet", value)),
} }
} }
@@ -41,19 +44,25 @@ impl BridgeHubRuntimeType {
pub fn chain_spec_from_json_file(&self, path: PathBuf) -> Result<Box<dyn ChainSpec>, String> { pub fn chain_spec_from_json_file(&self, path: PathBuf) -> Result<Box<dyn ChainSpec>, String> {
Ok(Box::new(match self { Ok(Box::new(match self {
BridgeHubRuntimeType::RococoLocal => rococo::BridgeHubChainSpec::from_json_file(path)?, BridgeHubRuntimeType::RococoLocal => rococo::BridgeHubChainSpec::from_json_file(path)?,
BridgeHubRuntimeType::WococoLocal => wococo::BridgeHubChainSpec::from_json_file(path)?,
})) }))
} }
pub fn load_config(&self) -> Box<dyn ChainSpec> { pub fn load_config(&self) -> Box<dyn ChainSpec> {
Box::new(match self { Box::new(match self {
BridgeHubRuntimeType::RococoLocal => BridgeHubRuntimeType::RococoLocal =>
rococo::local_config("rococo-local", ParaId::new(1013)), rococo::local_config("Rococo BrideHub Local", "rococo-local", ParaId::new(1013)),
BridgeHubRuntimeType::WococoLocal =>
wococo::local_config("Wococo BrideHub Local", "wococo-local", ParaId::new(1013)),
}) })
} }
pub fn runtime_version(&self) -> &'static RuntimeVersion { pub fn runtime_version(&self) -> &'static RuntimeVersion {
match self { match self {
BridgeHubRuntimeType::RococoLocal => &bridge_hub_rococo_runtime::VERSION, BridgeHubRuntimeType::RococoLocal | BridgeHubRuntimeType::WococoLocal => {
// this is intentional, for Rococo/Wococo we just want to have one runtime, which is configured for both sides
&bridge_hub_rococo_runtime::VERSION
},
} }
} }
} }
@@ -71,22 +80,29 @@ fn ensure_id(id: &str) -> Result<&str, String> {
} }
} }
/// Sub-module for Rococo setup
pub mod rococo { pub mod rococo {
use super::ParaId;
use crate::chain_spec::{ use crate::chain_spec::{
get_account_id_from_seed, get_collator_keys_from_seed, Extensions, SAFE_XCM_VERSION, get_account_id_from_seed, get_collator_keys_from_seed, Extensions, SAFE_XCM_VERSION,
}; };
use bridge_hub_rococo_runtime::{AccountId, AuraId}; use parachains_common::{AccountId, AuraId};
use cumulus_primitives_core::ParaId;
use sc_chain_spec::ChainType; use sc_chain_spec::ChainType;
use sp_core::sr25519; use sp_core::sr25519;
pub const BRIDGE_HUB_ROCOCO_LOCAL: &str = "bridge-hub-rococo-local"; pub(crate) const BRIDGE_HUB_ROCOCO_LOCAL: &str = "bridge-hub-rococo-local";
/// Specialized `ChainSpec` for the normal parachain runtime. /// Specialized `ChainSpec` for the normal parachain runtime.
pub type BridgeHubChainSpec = pub type BridgeHubChainSpec =
sc_service::GenericChainSpec<bridge_hub_rococo_runtime::GenesisConfig, Extensions>; sc_service::GenericChainSpec<bridge_hub_rococo_runtime::GenesisConfig, Extensions>;
pub fn local_config(relay_chain: &str, para_id: ParaId) -> BridgeHubChainSpec { pub type RuntimeApi = bridge_hub_rococo_runtime::RuntimeApi;
pub fn local_config(
chain_name: &str,
relay_chain: &str,
para_id: ParaId,
) -> BridgeHubChainSpec {
let properties = sc_chain_spec::Properties::new(); let properties = sc_chain_spec::Properties::new();
// TODO: check // TODO: check
// properties.insert("ss58Format".into(), 2.into()); // properties.insert("ss58Format".into(), 2.into());
@@ -95,7 +111,7 @@ pub mod rococo {
BridgeHubChainSpec::from_genesis( BridgeHubChainSpec::from_genesis(
// Name // Name
"Rococo BrideHub Local", chain_name,
// ID // ID
super::ensure_id(BRIDGE_HUB_ROCOCO_LOCAL).expect("invalid id"), super::ensure_id(BRIDGE_HUB_ROCOCO_LOCAL).expect("invalid id"),
ChainType::Local, ChainType::Local,
@@ -180,3 +196,22 @@ pub mod rococo {
} }
} }
} }
/// Sub-module for Wococo setup (reuses stuff from Rococo)
pub mod wococo {
use super::ParaId;
use crate::chain_spec::bridge_hubs::rococo;
pub(crate) const BRIDGE_HUB_WOCOCO_LOCAL: &str = "bridge-hub-wococo-local";
pub type BridgeHubChainSpec = rococo::BridgeHubChainSpec;
pub type RuntimeApi = rococo::RuntimeApi;
pub fn local_config(
chain_name: &str,
relay_chain: &str,
para_id: ParaId,
) -> BridgeHubChainSpec {
rococo::local_config(chain_name, relay_chain, para_id)
}
}
+13 -2
View File
@@ -37,6 +37,8 @@ use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::{AccountIdConversion, Block as BlockT}; use sp_runtime::traits::{AccountIdConversion, Block as BlockT};
use std::{net::SocketAddr, path::PathBuf}; use std::{net::SocketAddr, path::PathBuf};
use crate::chain_spec::bridge_hubs::BridgeHubRuntimeType;
/// Helper enum that is used for better distinction of different parachain/runtime configuration /// Helper enum that is used for better distinction of different parachain/runtime configuration
/// (it is based/calculated on ChainSpec's ID attribute) /// (it is based/calculated on ChainSpec's ID attribute)
#[derive(Debug, PartialEq, Default)] #[derive(Debug, PartialEq, Default)]
@@ -479,7 +481,11 @@ macro_rules! construct_async_run {
Runtime::BridgeHub(bridge_hub_runtime_type) => { Runtime::BridgeHub(bridge_hub_runtime_type) => {
runner.async_run(|$config| { runner.async_run(|$config| {
let $components = match bridge_hub_runtime_type { let $components = match bridge_hub_runtime_type {
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal => new_partial::<bridge_hub_rococo_runtime::RuntimeApi, _>( chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal => new_partial::<chain_spec::bridge_hubs::rococo::RuntimeApi, _>(
&$config,
crate::service::aura_build_import_queue::<_, AuraId>,
)?,
chain_spec::bridge_hubs::BridgeHubRuntimeType::WococoLocal => new_partial::<chain_spec::bridge_hubs::wococo::RuntimeApi, _>(
&$config, &$config,
crate::service::aura_build_import_queue::<_, AuraId>, crate::service::aura_build_import_queue::<_, AuraId>,
)?, )?,
@@ -775,7 +781,12 @@ pub fn run() -> Result<()> {
Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type { Runtime::BridgeHub(bridge_hub_runtime_type) => match bridge_hub_runtime_type {
chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal => chain_spec::bridge_hubs::BridgeHubRuntimeType::RococoLocal =>
crate::service::start_generic_aura_node::< crate::service::start_generic_aura_node::<
bridge_hub_rococo_runtime::RuntimeApi, chain_spec::bridge_hubs::rococo::RuntimeApi,
AuraId,
>(config, polkadot_config, collator_options, id, hwbench),
chain_spec::bridge_hubs::BridgeHubRuntimeType::WococoLocal =>
crate::service::start_generic_aura_node::<
chain_spec::bridge_hubs::wococo::RuntimeApi,
AuraId, AuraId,
>(config, polkadot_config, collator_options, id, hwbench), >(config, polkadot_config, collator_options, id, hwbench),
} }
@@ -0,0 +1,37 @@
[relaychain]
default_command = "{{POLKADOT_BINARY_PATH}}"
default_args = [ "-lparachain=debug" ]
chain = "rococo-local"
[[relaychain.nodes]]
name = "alice"
validator = true
[[relaychain.nodes]]
name = "bob"
validator = true
[[relaychain.nodes]]
name = "charlie"
validator = true
[[parachains]]
id = 1013
cumulus_based = true
chain = "bridge-hub-rococo-local"
[[parachains.collators]]
name = "alice"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
args = ["-lparachain=debug"]
[[parachains.collators]]
name = "bob"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
args = ["-lparachain=debug"]
[[parachains.collators]]
name = "charlie"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
args = ["-lparachain=debug"]
@@ -0,0 +1,37 @@
[relaychain]
default_command = "{{POLKADOT_BINARY_PATH}}"
default_args = [ "-lparachain=debug" ]
chain = "wococo-local"
[[relaychain.nodes]]
name = "alice"
validator = true
[[relaychain.nodes]]
name = "bob"
validator = true
[[relaychain.nodes]]
name = "charlie"
validator = true
[[parachains]]
id = 1013
cumulus_based = true
chain = "bridge-hub-wococo-local"
[[parachains.collators]]
name = "alice"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
args = ["-lparachain=debug"]
[[parachains.collators]]
name = "bob"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
args = ["-lparachain=debug"]
[[parachains.collators]]
name = "charlie"
command = "{{POLKADOT_PARACHAIN_BINARY_PATH}}"
args = ["-lparachain=debug"]