Skip to content

Commit

Permalink
Add support for BHP local and BHK local (#3443)
Browse files Browse the repository at this point in the history
Related to paritytech/polkadot-sdk#3400

Extracting small parts of
paritytech/polkadot-sdk#3429 into separate PR:

- Add support for BHP local and BHK local
- Increase the timeout for the bridge zomienet tests
  • Loading branch information
serban300 committed Feb 23, 2024
1 parent 9bf1a5e commit e4b6b8c
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions bridges/testing/tests/0001-asset-transfer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ source "${BASH_SOURCE%/*}/../../utils/zombienet.sh"
${BASH_SOURCE%/*}/../../environments/rococo-westend/spawn.sh --init --start-relayer &
env_pid=$!

ensure_process_file $env_pid $TEST_DIR/rococo.env 400
ensure_process_file $env_pid $TEST_DIR/rococo.env 600
rococo_dir=`cat $TEST_DIR/rococo.env`
echo

ensure_process_file $env_pid $TEST_DIR/westend.env 180
ensure_process_file $env_pid $TEST_DIR/westend.env 300
westend_dir=`cat $TEST_DIR/westend.env`
echo

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ source "${BASH_SOURCE%/*}/../../utils/zombienet.sh"
${BASH_SOURCE%/*}/../../environments/rococo-westend/spawn.sh &
env_pid=$!

ensure_process_file $env_pid $TEST_DIR/rococo.env 400
ensure_process_file $env_pid $TEST_DIR/rococo.env 600
rococo_dir=`cat $TEST_DIR/rococo.env`
echo

ensure_process_file $env_pid $TEST_DIR/westend.env 180
ensure_process_file $env_pid $TEST_DIR/westend.env 300
westend_dir=`cat $TEST_DIR/westend.env`
echo

Expand Down
8 changes: 8 additions & 0 deletions cumulus/polkadot-parachain/src/chain_spec/bridge_hubs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ use std::str::FromStr;
#[derive(Debug, PartialEq)]
pub enum BridgeHubRuntimeType {
Kusama,
KusamaLocal,

Polkadot,
PolkadotLocal,

Rococo,
RococoLocal,
Expand All @@ -44,7 +47,9 @@ impl FromStr for BridgeHubRuntimeType {
fn from_str(value: &str) -> Result<Self, Self::Err> {
match value {
polkadot::BRIDGE_HUB_POLKADOT => Ok(BridgeHubRuntimeType::Polkadot),
polkadot::BRIDGE_HUB_POLKADOT_LOCAL => Ok(BridgeHubRuntimeType::PolkadotLocal),
kusama::BRIDGE_HUB_KUSAMA => Ok(BridgeHubRuntimeType::Kusama),
kusama::BRIDGE_HUB_KUSAMA_LOCAL => Ok(BridgeHubRuntimeType::KusamaLocal),
westend::BRIDGE_HUB_WESTEND => Ok(BridgeHubRuntimeType::Westend),
westend::BRIDGE_HUB_WESTEND_LOCAL => Ok(BridgeHubRuntimeType::WestendLocal),
westend::BRIDGE_HUB_WESTEND_DEVELOPMENT => Ok(BridgeHubRuntimeType::WestendDevelopment),
Expand Down Expand Up @@ -103,6 +108,7 @@ impl BridgeHubRuntimeType {
Some("Bob".to_string()),
|_| (),
))),
other => Err(std::format!("No default config present for {:?}", other)),
}
}
}
Expand Down Expand Up @@ -242,6 +248,7 @@ pub mod rococo {
/// Sub-module for Kusama setup
pub mod kusama {
pub(crate) const BRIDGE_HUB_KUSAMA: &str = "bridge-hub-kusama";
pub(crate) const BRIDGE_HUB_KUSAMA_LOCAL: &str = "bridge-hub-kusama-local";
}

/// Sub-module for Westend setup.
Expand Down Expand Up @@ -358,4 +365,5 @@ pub mod westend {
/// Sub-module for Polkadot setup
pub mod polkadot {
pub(crate) const BRIDGE_HUB_POLKADOT: &str = "bridge-hub-polkadot";
pub(crate) const BRIDGE_HUB_POLKADOT_LOCAL: &str = "bridge-hub-polkadot-local";
}
6 changes: 4 additions & 2 deletions cumulus/polkadot-parachain/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -755,14 +755,16 @@ pub fn run() -> Result<()> {
.map_err(Into::into),

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 =>
crate::service::start_generic_aura_node::<
RuntimeApi,
AuraId,
>(config, polkadot_config, collator_options, id, hwbench)
.await
.map(|r| r.0),
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama =>
chain_spec::bridge_hubs::BridgeHubRuntimeType::Kusama |
chain_spec::bridge_hubs::BridgeHubRuntimeType::KusamaLocal =>
crate::service::start_generic_aura_node::<
RuntimeApi,
AuraId,
Expand Down

0 comments on commit e4b6b8c

Please sign in to comment.