feat: initialize Kurdistan SDK - independent fork of Polkadot SDK
This commit is contained in:
+74
@@ -0,0 +1,74 @@
|
||||
[settings]
|
||||
node_spawn_timeout = 240
|
||||
|
||||
[relaychain]
|
||||
default_command = "{{PEZKUWI_BINARY}}"
|
||||
default_args = ["-lteyrchain=debug,xcm=trace"]
|
||||
chain = "pezkuwichain-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice-pezkuwichain-validator"
|
||||
validator = true
|
||||
rpc_port = 9942
|
||||
balance = 2000000000000
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob-pezkuwichain-validator"
|
||||
validator = true
|
||||
rpc_port = 9943
|
||||
balance = 2000000000000
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "charlie-pezkuwichain-validator"
|
||||
validator = true
|
||||
rpc_port = 9944
|
||||
balance = 2000000000000
|
||||
|
||||
[[teyrchains]]
|
||||
id = 1013
|
||||
chain = "bridge-hub-pezkuwichain-local"
|
||||
cumulus_based = true
|
||||
|
||||
# run alice as teyrchain collator
|
||||
[[teyrchains.collators]]
|
||||
name = "bridge-hub-pezkuwichain-collator1"
|
||||
validator = true
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
rpc_port = 8943
|
||||
args = ["-lteyrchain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"]
|
||||
|
||||
# run bob as teyrchain collator
|
||||
[[teyrchains.collators]]
|
||||
name = "bridge-hub-pezkuwichain-collator2"
|
||||
validator = true
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
rpc_port = 8944
|
||||
args = ["-lteyrchain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"]
|
||||
|
||||
[[teyrchains]]
|
||||
id = 1000
|
||||
chain = "asset-hub-pezkuwichain-local"
|
||||
cumulus_based = true
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "asset-hub-pezkuwichain-collator1"
|
||||
rpc_port = 9910
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
args = ["-lteyrchain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"]
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "asset-hub-pezkuwichain-collator2"
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
args = ["-lteyrchain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"]
|
||||
|
||||
#[[hrmp_channels]]
|
||||
#sender = 1000
|
||||
#recipient = 1013
|
||||
#max_capacity = 4
|
||||
#max_message_size = 524288
|
||||
#
|
||||
#[[hrmp_channels]]
|
||||
#sender = 1013
|
||||
#recipient = 1000
|
||||
#max_capacity = 4
|
||||
#max_message_size = 524288
|
||||
@@ -0,0 +1,74 @@
|
||||
[settings]
|
||||
node_spawn_timeout = 240
|
||||
|
||||
[relaychain]
|
||||
default_command = "{{PEZKUWI_BINARY}}"
|
||||
default_args = ["-lteyrchain=debug,xcm=trace"]
|
||||
chain = "zagros-local"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice-zagros-validator"
|
||||
validator = true
|
||||
rpc_port = 9945
|
||||
balance = 2000000000000
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob-zagros-validator"
|
||||
validator = true
|
||||
rpc_port = 9946
|
||||
balance = 2000000000000
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "charlie-zagros-validator"
|
||||
validator = true
|
||||
rpc_port = 9947
|
||||
balance = 2000000000000
|
||||
|
||||
[[teyrchains]]
|
||||
id = 1002
|
||||
chain = "bridge-hub-zagros-local"
|
||||
cumulus_based = true
|
||||
|
||||
# run alice as teyrchain collator
|
||||
[[teyrchains.collators]]
|
||||
name = "bridge-hub-zagros-collator1"
|
||||
validator = true
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
rpc_port = 8945
|
||||
args = ["-lteyrchain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"]
|
||||
|
||||
# run bob as teyrchain collator
|
||||
[[teyrchains.collators]]
|
||||
name = "bridge-hub-zagros-collator2"
|
||||
validator = true
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
rpc_port = 8946
|
||||
args = ["-lteyrchain=debug,runtime::bridge=trace,xcm=trace,txpool=trace"]
|
||||
|
||||
[[teyrchains]]
|
||||
id = 1000
|
||||
chain = "asset-hub-zagros-local"
|
||||
cumulus_based = true
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "asset-hub-zagros-collator1"
|
||||
rpc_port = 9010
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
args = ["-lteyrchain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"]
|
||||
|
||||
[[teyrchains.collators]]
|
||||
name = "asset-hub-zagros-collator2"
|
||||
command = "{{PEZKUWI_TEYRCHAIN_BINARY}}"
|
||||
args = ["-lteyrchain=debug,xcm=trace,runtime::bridge=trace,txpool=trace"]
|
||||
|
||||
#[[hrmp_channels]]
|
||||
#sender = 1000
|
||||
#recipient = 1002
|
||||
#max_capacity = 4
|
||||
#max_message_size = 524288
|
||||
#
|
||||
#[[hrmp_channels]]
|
||||
#sender = 1002
|
||||
#recipient = 1000
|
||||
#max_capacity = 4
|
||||
#max_message_size = 524288
|
||||
+470
@@ -0,0 +1,470 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# import common functions
|
||||
source "$FRAMEWORK_PATH/utils/bridges.sh"
|
||||
|
||||
# Expected sovereign accounts.
|
||||
#
|
||||
# Generated by:
|
||||
#
|
||||
##[test]
|
||||
#fn generate_sovereign_accounts() {
|
||||
# use pezkuwi_teyrchain_primitives::primitives::Sibling;
|
||||
# use sp_core::crypto::Ss58Codec;
|
||||
# use staging_xcm_builder::{GlobalConsensusConvertsFor, SiblingTeyrchainConvertsVia};
|
||||
# use xcm::latest::{prelude::*, PEZKUWICHAIN_GENESIS_HASH, ZAGROS_GENESIS_HASH};
|
||||
# use xcm_executor::traits::ConvertLocation;
|
||||
#
|
||||
# const Pezkuwichain: NetworkId = NetworkId::ByGenesis(PEZKUWICHAIN_GENESIS_HASH);
|
||||
# const Zagros: NetworkId = NetworkId::ByGenesis(ZAGROS_GENESIS_HASH);
|
||||
# frame_support::parameter_types! {
|
||||
# pub UniversalLocationAHR: InteriorLocation = [GlobalConsensus(Pezkuwichain), Teyrchain(1000)].into();
|
||||
# pub UniversalLocationAHW: InteriorLocation = [GlobalConsensus(Zagros), Teyrchain(1000)].into();
|
||||
# }
|
||||
#
|
||||
# // SS58=42
|
||||
# println!("ASSET_HUB_ZAGROS_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ZAGROS=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# SiblingTeyrchainConvertsVia::<Sibling, [u8; 32]>::convert_location(
|
||||
# &Location { parents: 1, interior: Teyrchain(1000).into() }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
#
|
||||
# // SS58=42
|
||||
# println!("ASSET_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_PEZKUWICHAIN=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# SiblingTeyrchainConvertsVia::<Sibling, [u8; 32]>::convert_location(
|
||||
# &Location { parents: 1, interior: Teyrchain(1000).into() }).unwrap()
|
||||
# ).to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
#}
|
||||
ASSET_HUB_ZAGROS_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ZAGROS="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV"
|
||||
ASSET_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_PEZKUWICHAIN="5Eg2fntNprdN3FgH4sfEaaZhYtddZQSQUqvYJ1f2mLtinVhV"
|
||||
BOB_ACCOUNT_AT_PEZKUWICHAIN="5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
|
||||
BOB_ACCOUNT_AT_ZAGROS="5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty"
|
||||
|
||||
# Expected sovereign accounts for rewards on BridgeHubs.
|
||||
#
|
||||
# Generated by:
|
||||
##[test]
|
||||
#fn generate_sovereign_accounts_for_rewards() {
|
||||
# use bp_messages::LegacyLaneId;
|
||||
# use bp_relayers::{PayRewardFromAccount, RewardsAccountOwner, RewardsAccountParams};
|
||||
# use sp_core::crypto::Ss58Codec;
|
||||
#
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_ThisChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32], LegacyLaneId>::rewards_account(RewardsAccountParams::new(
|
||||
# LegacyLaneId([0, 0, 0, 2]),
|
||||
# *b"bhwd",
|
||||
# RewardsAccountOwner::ThisChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_BridgedChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32], LegacyLaneId>::rewards_account(RewardsAccountParams::new(
|
||||
# LegacyLaneId([0, 0, 0, 2]),
|
||||
# *b"bhwd",
|
||||
# RewardsAccountOwner::BridgedChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
#
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_ZAGROS_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_ThisChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32], LegacyLaneId>::rewards_account(RewardsAccountParams::new(
|
||||
# LegacyLaneId([0, 0, 0, 2]),
|
||||
# *b"bhro",
|
||||
# RewardsAccountOwner::ThisChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
# // SS58=42
|
||||
# println!(
|
||||
# "ON_BRIDGE_HUB_ZAGROS_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain=\"{}\"",
|
||||
# frame_support::sp_runtime::AccountId32::new(
|
||||
# PayRewardFromAccount::<[u8; 32], [u8; 32], LegacyLaneId>::rewards_account(RewardsAccountParams::new(
|
||||
# LegacyLaneId([0, 0, 0, 2]),
|
||||
# *b"bhro",
|
||||
# RewardsAccountOwner::BridgedChain
|
||||
# ))
|
||||
# )
|
||||
# .to_ss58check_with_version(42_u16.into())
|
||||
# );
|
||||
#}
|
||||
ON_BRIDGE_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_ThisChain="5EHnXaT5GApse1euZWj9hycMbgjKBCNQL9WEwScL8QDx6mhK"
|
||||
ON_BRIDGE_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_BridgedChain="5EHnXaT5Tnt4A8aiP9CsuAFRhKPjKZJXRrj4a3mtihFvKpTi"
|
||||
ON_BRIDGE_HUB_ZAGROS_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_ThisChain="5EHnXaT5GApry9tS6yd1FVusPq8o8bQJGCKyvXTFCoEKk5Z9"
|
||||
ON_BRIDGE_HUB_ZAGROS_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain="5EHnXaT5Tnt3VGpEvc6jSgYwVToDGxLRMuYoZ8coo6GHyWbR"
|
||||
|
||||
LANE_ID="00000002"
|
||||
XCM_VERSION=5
|
||||
# 6408de7737c59c238890533af25896a2c20608d8b380bb01029acb392781063e
|
||||
PEZKUWICHAIN_GENESIS_HASH=[100,8,222,119,55,197,156,35,136,144,83,58,242,88,150,162,194,6,8,216,179,128,187,1,2,154,203,57,39,129,6,62]
|
||||
# e143f23803ac50e8f6f8e62695d1ce9e4e1d68aa36c1cd2cfd15340213f3423e
|
||||
ZAGROS_GENESIS_HASH=[225,67,242,56,3,172,80,232,246,248,230,38,149,209,206,158,78,29,104,170,54,193,205,44,253,21,52,2,19,243,66,62]
|
||||
|
||||
function init_ro_wnd() {
|
||||
local relayer_path=$(ensure_relayer)
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path init-bridge pezkuwichain-to-bridge-hub-zagros \
|
||||
--source-uri ws://localhost:9942 \
|
||||
--source-version-mode Auto \
|
||||
--target-uri ws://localhost:8945 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Bob
|
||||
}
|
||||
|
||||
function init_wnd_ro() {
|
||||
local relayer_path=$(ensure_relayer)
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path init-bridge zagros-to-bridge-hub-pezkuwichain \
|
||||
--source-uri ws://localhost:9945 \
|
||||
--source-version-mode Auto \
|
||||
--target-uri ws://localhost:8943 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Bob
|
||||
}
|
||||
|
||||
function run_finality_relay() {
|
||||
local relayer_path=$(ensure_relayer)
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path relay-headers pezkuwichain-to-bridge-hub-zagros \
|
||||
--only-free-headers \
|
||||
--source-uri ws://localhost:9942 \
|
||||
--source-version-mode Auto \
|
||||
--target-uri ws://localhost:8945 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Charlie \
|
||||
--target-transactions-mortality 4&
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path relay-headers zagros-to-bridge-hub-pezkuwichain \
|
||||
--only-free-headers \
|
||||
--source-uri ws://localhost:9945 \
|
||||
--source-version-mode Auto \
|
||||
--target-uri ws://localhost:8943 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Charlie \
|
||||
--target-transactions-mortality 4
|
||||
}
|
||||
|
||||
function run_teyrchains_relay() {
|
||||
local relayer_path=$(ensure_relayer)
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path relay-teyrchains bridge-hub-pezkuwichain-to-bridge-hub-zagros \
|
||||
--only-free-headers \
|
||||
--source-uri ws://localhost:9942 \
|
||||
--source-version-mode Auto \
|
||||
--target-uri ws://localhost:8945 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Dave \
|
||||
--target-transactions-mortality 4&
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path relay-teyrchains bridge-hub-zagros-to-bridge-hub-pezkuwichain \
|
||||
--only-free-headers \
|
||||
--source-uri ws://localhost:9945 \
|
||||
--source-version-mode Auto \
|
||||
--target-uri ws://localhost:8943 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Dave \
|
||||
--target-transactions-mortality 4
|
||||
}
|
||||
|
||||
function run_messages_relay() {
|
||||
local relayer_path=$(ensure_relayer)
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path relay-messages bridge-hub-pezkuwichain-to-bridge-hub-zagros \
|
||||
--source-uri ws://localhost:8943 \
|
||||
--source-version-mode Auto \
|
||||
--source-signer //Eve \
|
||||
--source-transactions-mortality 4 \
|
||||
--target-uri ws://localhost:8945 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Eve \
|
||||
--target-transactions-mortality 4 \
|
||||
--lane $LANE_ID&
|
||||
|
||||
RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
|
||||
$relayer_path relay-messages bridge-hub-zagros-to-bridge-hub-pezkuwichain \
|
||||
--source-uri ws://localhost:8945 \
|
||||
--source-version-mode Auto \
|
||||
--source-signer //Ferdie \
|
||||
--source-transactions-mortality 4 \
|
||||
--target-uri ws://localhost:8943 \
|
||||
--target-version-mode Auto \
|
||||
--target-signer //Ferdie \
|
||||
--target-transactions-mortality 4 \
|
||||
--lane $LANE_ID
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
run-finality-relay)
|
||||
init_wnd_ro
|
||||
init_ro_wnd
|
||||
run_finality_relay
|
||||
;;
|
||||
run-teyrchains-relay)
|
||||
run_teyrchains_relay
|
||||
;;
|
||||
run-messages-relay)
|
||||
run_messages_relay
|
||||
;;
|
||||
init-pezkuwichain-local)
|
||||
# HRMP
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1000 1013 4 524288
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1013 1000 4 524288
|
||||
# governance set XCM version of remote AssetHubZagros on AHR
|
||||
force_xcm_version \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1000 \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }, { "Teyrchain": 1000 } ] } }')" \
|
||||
$XCM_VERSION
|
||||
# governance set XCM version of remote BridgeHubZagros on BHR
|
||||
force_xcm_version \
|
||||
"ws://127.0.0.1:9942" \
|
||||
"//Alice" \
|
||||
1013 \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }, { "Teyrchain": 1002 } ] } }')" \
|
||||
$XCM_VERSION
|
||||
;;
|
||||
init-asset-hub-pezkuwichain-local)
|
||||
ensure_pezkuwi_js_api
|
||||
# create foreign asset pool
|
||||
create_pool \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"//Bob" \
|
||||
"$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }] } }')"
|
||||
# Create liquidity in the pool
|
||||
add_liquidity \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"//Bob" \
|
||||
"$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }] } }')" \
|
||||
1000000000000 \
|
||||
2500000000000 \
|
||||
"$BOB_ACCOUNT_AT_PEZKUWICHAIN"
|
||||
;;
|
||||
init-bridge-hub-pezkuwichain-local)
|
||||
ensure_pezkuwi_js_api
|
||||
# SA of sibling asset hub pays for the execution
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Alice" \
|
||||
"$ASSET_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_PEZKUWICHAIN" \
|
||||
100000000000000
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_ThisChain" \
|
||||
100000000000000
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_PEZKUWICHAIN_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhwd_BridgedChain" \
|
||||
100000000000000
|
||||
;;
|
||||
init-zagros-local)
|
||||
# HRMP
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1000 1002 4 524288
|
||||
open_hrmp_channels \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1002 1000 4 524288
|
||||
# governance set XCM version of remote AssetHubPezkuwichain on AHW
|
||||
force_xcm_version \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1000 \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }, { "Teyrchain": 1000 } ] } }')" \
|
||||
$XCM_VERSION
|
||||
# governance set XCM version of remote BridgeHubPezkuwichain on BHW
|
||||
force_xcm_version \
|
||||
"ws://127.0.0.1:9945" \
|
||||
"//Alice" \
|
||||
1002 \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }, { "Teyrchain": 1013 } ] } }')" \
|
||||
$XCM_VERSION
|
||||
;;
|
||||
init-asset-hub-zagros-local)
|
||||
ensure_pezkuwi_js_api
|
||||
# create foreign asset pool
|
||||
create_pool \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"//Bob" \
|
||||
"$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }] } }')"
|
||||
# Create liquidity in the pool
|
||||
add_liquidity \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"//Bob" \
|
||||
"$(jq --null-input '{ "parents": 1, "interior": "Here" }')" \
|
||||
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }] } }')" \
|
||||
1000000000000 \
|
||||
4000000000000 \
|
||||
"$BOB_ACCOUNT_AT_ZAGROS"
|
||||
;;
|
||||
init-bridge-hub-zagros-local)
|
||||
# SA of sibling asset hub pays for the execution
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Alice" \
|
||||
"$ASSET_HUB_ZAGROS_SOVEREIGN_ACCOUNT_AT_BRIDGE_HUB_ZAGROS" \
|
||||
100000000000000
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_ZAGROS_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_ThisChain" \
|
||||
100000000000000
|
||||
# drip SA of lane dedicated to asset hub for paying rewards for delivery confirmation
|
||||
transfer_balance \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Alice" \
|
||||
"$ON_BRIDGE_HUB_ZAGROS_SOVEREIGN_ACCOUNT_FOR_LANE_00000002_bhro_BridgedChain" \
|
||||
100000000000000
|
||||
;;
|
||||
reserve-transfer-assets-from-asset-hub-pezkuwichain-local)
|
||||
amount=$2
|
||||
ensure_pezkuwi_js_api
|
||||
# send TYRs to Alice account on AHW
|
||||
limited_reserve_transfer_assets \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"//Alice" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }, { "Teyrchain": 1000 } ] } } }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 0, "interior": { "X1": [{ "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } }] } } }')" \
|
||||
"$(jq --null-input '{ "V5": [ { "id": { "parents": 1, "interior": "Here" }, "fun": { "Fungible": '$amount' } } ] }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 1, "interior": "Here" } }')" \
|
||||
"Unlimited"
|
||||
;;
|
||||
withdraw-reserve-assets-from-asset-hub-pezkuwichain-local)
|
||||
amount=$2
|
||||
ensure_pezkuwi_js_api
|
||||
# send back only 100000000000 wrappedWNDs to Alice account on AHW
|
||||
limited_reserve_transfer_assets \
|
||||
"ws://127.0.0.1:9910" \
|
||||
"//Alice" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }, { "Teyrchain": 1000 } ] } } }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 0, "interior": { "X1": [{ "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } }] } } }')" \
|
||||
"$(jq --null-input '{ "V5": [ { "id": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }] } }, "fun": { "Fungible": '$amount' } } ] }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$ZAGROS_GENESIS_HASH' } }] } } }')" \
|
||||
"Unlimited"
|
||||
;;
|
||||
reserve-transfer-assets-from-asset-hub-zagros-local)
|
||||
amount=$2
|
||||
ensure_pezkuwi_js_api
|
||||
# send ZGRs to Alice account on AHR
|
||||
limited_reserve_transfer_assets \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"//Alice" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }, { "Teyrchain": 1000 } ] } } }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 0, "interior": { "X1": [{ "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } }] } } }')" \
|
||||
"$(jq --null-input '{ "V5": [ { "id": { "parents": 1, "interior": "Here" }, "fun": { "Fungible": '$amount' } } ] }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 1, "interior": "Here" } }')" \
|
||||
"Unlimited"
|
||||
;;
|
||||
withdraw-reserve-assets-from-asset-hub-zagros-local)
|
||||
amount=$2
|
||||
ensure_pezkuwi_js_api
|
||||
# send back only 100000000000 wrappedTYRs to Alice account on AHR
|
||||
limited_reserve_transfer_assets \
|
||||
"ws://127.0.0.1:9010" \
|
||||
"//Alice" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }, { "Teyrchain": 1000 } ] } } }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 0, "interior": { "X1": [{ "AccountId32": { "id": [212, 53, 147, 199, 21, 253, 211, 28, 97, 20, 26, 189, 4, 169, 159, 214, 130, 44, 133, 88, 133, 76, 205, 227, 154, 86, 132, 231, 165, 109, 162, 125] } }] } } }')" \
|
||||
"$(jq --null-input '{ "V5": [ { "id": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }] } }, "fun": { "Fungible": '$amount' } } ] }')" \
|
||||
"$(jq --null-input '{ "V5": { "parents": 2, "interior": { "X1": [{ "GlobalConsensus": { ByGenesis: '$PEZKUWICHAIN_GENESIS_HASH' } }] } } }')" \
|
||||
"Unlimited"
|
||||
;;
|
||||
claim-rewards-bridge-hub-pezkuwichain-local)
|
||||
ensure_pezkuwi_js_api
|
||||
# bhwd -> [62, 68, 77, 64] -> 0x62687764
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x62687764" \
|
||||
"ThisChain"
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8943" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x62687764" \
|
||||
"BridgedChain"
|
||||
;;
|
||||
claim-rewards-bridge-hub-zagros-local)
|
||||
# bhro -> [62, 68, 72, 6f] -> 0x6268726f
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x6268726f" \
|
||||
"ThisChain"
|
||||
claim_rewards \
|
||||
"ws://127.0.0.1:8945" \
|
||||
"//Charlie" \
|
||||
"0x${LANE_ID}" \
|
||||
"0x6268726f" \
|
||||
"BridgedChain"
|
||||
;;
|
||||
stop)
|
||||
pkill -f pezkuwi
|
||||
pkill -f teyrchain
|
||||
;;
|
||||
import)
|
||||
# to avoid trigger anything here
|
||||
;;
|
||||
*)
|
||||
echo "A command is require. Supported commands for:
|
||||
Local (zombienet) run:
|
||||
- run-finality-relay
|
||||
- run-teyrchains-relay
|
||||
- run-messages-relay
|
||||
- init-pezkuwichain-local
|
||||
- init-asset-hub-pezkuwichain-local
|
||||
- init-bridge-hub-pezkuwichain-local
|
||||
- init-zagros-local
|
||||
- init-asset-hub-zagros-local
|
||||
- init-bridge-hub-zagros-local
|
||||
- reserve-transfer-assets-from-asset-hub-pezkuwichain-local
|
||||
- withdraw-reserve-assets-from-asset-hub-pezkuwichain-local
|
||||
- reserve-transfer-assets-from-asset-hub-zagros-local
|
||||
- withdraw-reserve-assets-from-asset-hub-zagros-local
|
||||
- claim-rewards-bridge-hub-pezkuwichain-local
|
||||
- claim-rewards-bridge-hub-zagros-local";
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
@@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Pezkuwichain AH
|
||||
xdg-open https://pezkuwichain.io/?rpc=ws://127.0.0.1:9910#/explorer&
|
||||
# Pezkuwichain BH
|
||||
xdg-open https://pezkuwichain.io/?rpc=ws://127.0.0.1:8943#/explorer&
|
||||
|
||||
# Zagros BH
|
||||
xdg-open https://pezkuwichain.io/?rpc=ws://127.0.0.1:8945#/explorer&
|
||||
# Zagros AH
|
||||
xdg-open https://pezkuwichain.io/?rpc=ws://127.0.0.1:9010#/explorer&
|
||||
@@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
if [ $1 == "auto-log" ]; then
|
||||
shift # ignore "auto-log"
|
||||
log_name=$1
|
||||
$ENV_PATH/bridges_pezkuwichain_zagros.sh "$@" >$TEST_DIR/logs/$log_name.log
|
||||
else
|
||||
$ENV_PATH/bridges_pezkuwichain_zagros.sh "$@"
|
||||
fi
|
||||
@@ -0,0 +1,7 @@
|
||||
Description: Check if the with-Zagros GRANDPA pallet was initialized at Rococo BH
|
||||
Network: ./bridge_hub_rococo_local_network.toml
|
||||
Creds: config
|
||||
|
||||
# relay is already started - let's wait until with-Zagros GRANDPA pallet is initialized at Rococo
|
||||
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/best-finalized-header-at-bridged-chain.js with "Zagros,0" within 400 seconds
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Description: Check if the HRMP channel between Rococo BH and Rococo AH was opened successfully
|
||||
Network: ./bridge_hub_rococo_local_network.toml
|
||||
Creds: config
|
||||
|
||||
# ensure that initialization has completed
|
||||
asset-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/wait-hrmp-channel-opened.js with "1013" within 300 seconds
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Description: Check if the Rococo teyrchains started producing blocks reliably
|
||||
Network: ./bridge_hub_zagros_local_network.toml
|
||||
Creds: config
|
||||
|
||||
# ensure that initialization has completed
|
||||
asset-hub-rococo-collator1: reports block height is at least 10 within 180 seconds
|
||||
bridge-hub-rococo-collator1: reports block height is at least 10 within 180 seconds
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
trap "trap - SIGTERM && kill -9 -$$" SIGINT SIGTERM EXIT
|
||||
|
||||
source "$FRAMEWORK_PATH/utils/zombienet.sh"
|
||||
|
||||
# whether to init the chains (open HRMP channels, set XCM version, create reserve assets, etc)
|
||||
init=0
|
||||
start_relayer=0
|
||||
while [ $# -ne 0 ]
|
||||
do
|
||||
arg="$1"
|
||||
case "$arg" in
|
||||
--init)
|
||||
init=1
|
||||
;;
|
||||
--start-relayer)
|
||||
start_relayer=1
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
logs_dir=$TEST_DIR/logs
|
||||
helper_script="${BASH_SOURCE%/*}/helper.sh"
|
||||
|
||||
pezkuwichain_def=${BASH_SOURCE%/*}/bridge_hub_pezkuwichain_local_network.toml
|
||||
start_zombienet $TEST_DIR $pezkuwichain_def pezkuwichain_dir pezkuwichain_pid
|
||||
echo
|
||||
|
||||
zagros_def=${BASH_SOURCE%/*}/bridge_hub_zagros_local_network.toml
|
||||
start_zombienet $TEST_DIR $zagros_def zagros_dir zagros_pid
|
||||
echo
|
||||
|
||||
if [[ $init -eq 1 ]]; then
|
||||
run_zndsl ${BASH_SOURCE%/*}/pezkuwichain-start.zndsl $pezkuwichain_dir
|
||||
run_zndsl ${BASH_SOURCE%/*}/zagros-start.zndsl $zagros_dir
|
||||
|
||||
pezkuwichain_init_log=$logs_dir/pezkuwichain-init.log
|
||||
echo -e "Setting up the pezkuwichain side of the bridge. Logs available at: $pezkuwichain_init_log\n"
|
||||
zagros_init_log=$logs_dir/zagros-init.log
|
||||
echo -e "Setting up the zagros side of the bridge. Logs available at: $zagros_init_log\n"
|
||||
|
||||
$helper_script init-pezkuwichain-local >> $pezkuwichain_init_log 2>&1 &
|
||||
pezkuwichain_init_pid=$!
|
||||
$helper_script init-zagros-local >> $zagros_init_log 2>&1 &
|
||||
zagros_init_pid=$!
|
||||
wait $pezkuwichain_init_pid $zagros_init_pid
|
||||
|
||||
run_zndsl ${BASH_SOURCE%/*}/pezkuwichain-init.zndsl $pezkuwichain_dir
|
||||
run_zndsl ${BASH_SOURCE%/*}/zagros-init.zndsl $zagros_dir
|
||||
|
||||
$helper_script init-asset-hub-pezkuwichain-local >> $pezkuwichain_init_log 2>&1 &
|
||||
pezkuwichain_init_pid=$!
|
||||
$helper_script init-asset-hub-zagros-local >> $zagros_init_log 2>&1 &
|
||||
zagros_init_pid=$!
|
||||
wait $pezkuwichain_init_pid $zagros_init_pid
|
||||
|
||||
$helper_script init-bridge-hub-pezkuwichain-local >> $pezkuwichain_init_log 2>&1 &
|
||||
pezkuwichain_init_pid=$!
|
||||
$helper_script init-bridge-hub-zagros-local >> $zagros_init_log 2>&1 &
|
||||
zagros_init_pid=$!
|
||||
wait $pezkuwichain_init_pid $zagros_init_pid
|
||||
fi
|
||||
|
||||
if [[ $start_relayer -eq 1 ]]; then
|
||||
${BASH_SOURCE%/*}/start_relayer.sh $pezkuwichain_dir $zagros_dir finality_relayer_pid teyrchains_relayer_pid messages_relayer_pid
|
||||
fi
|
||||
|
||||
echo $pezkuwichain_dir > $TEST_DIR/pezkuwichain.env
|
||||
echo $zagros_dir > $TEST_DIR/zagros.env
|
||||
echo
|
||||
|
||||
wait -n $pezkuwichain_pid $zagros_pid $finality_relayer_pid $teyrchains_relayer_pid $messages_relayer_pid
|
||||
kill -9 -$$
|
||||
@@ -0,0 +1,37 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
source "$FRAMEWORK_PATH/utils/common.sh"
|
||||
source "$FRAMEWORK_PATH/utils/zombienet.sh"
|
||||
|
||||
pezkuwichain_dir=$1
|
||||
zagros_dir=$2
|
||||
__finality_relayer_pid=$3
|
||||
__teyrchains_relayer_pid=$4
|
||||
__messages_relayer_pid=$5
|
||||
|
||||
logs_dir=$TEST_DIR/logs
|
||||
helper_script="${BASH_SOURCE%/*}/helper.sh"
|
||||
|
||||
# start finality relayer
|
||||
finality_relayer_log=$logs_dir/relayer_finality.log
|
||||
echo -e "Starting pezkuwichain-zagros finality relayer. Logs available at: $finality_relayer_log\n"
|
||||
start_background_process "$helper_script run-finality-relay" $finality_relayer_log finality_relayer_pid
|
||||
|
||||
# start teyrchains relayer
|
||||
teyrchains_relayer_log=$logs_dir/relayer_teyrchains.log
|
||||
echo -e "Starting pezkuwichain-zagros teyrchains relayer. Logs available at: $teyrchains_relayer_log\n"
|
||||
start_background_process "$helper_script run-teyrchains-relay" $teyrchains_relayer_log teyrchains_relayer_pid
|
||||
|
||||
# start messages relayer
|
||||
messages_relayer_log=$logs_dir/relayer_messages.log
|
||||
echo -e "Starting pezkuwichain-zagros messages relayer. Logs available at: $messages_relayer_log\n"
|
||||
start_background_process "$helper_script run-messages-relay" $messages_relayer_log messages_relayer_pid
|
||||
|
||||
run_zndsl ${BASH_SOURCE%/*}/pezkuwichain-bridge.zndsl $pezkuwichain_dir
|
||||
run_zndsl ${BASH_SOURCE%/*}/zagros-bridge.zndsl $zagros_dir
|
||||
|
||||
eval $__finality_relayer_pid="'$finality_relayer_pid'"
|
||||
eval $__teyrchains_relayer_pid="'$teyrchains_relayer_pid'"
|
||||
eval $__messages_relayer_pid="'$messages_relayer_pid'"
|
||||
@@ -0,0 +1,6 @@
|
||||
Description: Check if the with-Rococo GRANDPA pallet was initialized at Zagros BH
|
||||
Network: ./bridge_hub_zagros_local_network.toml
|
||||
Creds: config
|
||||
|
||||
# relay is already started - let's wait until with-Rococo GRANDPA pallet is initialized at Zagros
|
||||
bridge-hub-zagros-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/best-finalized-header-at-bridged-chain.js with "Rococo,0" within 400 seconds
|
||||
@@ -0,0 +1,7 @@
|
||||
Description: Check if the HRMP channel between Zagros BH and Zagros AH was opened successfully
|
||||
Network: ./bridge_hub_zagros_local_network.toml
|
||||
Creds: config
|
||||
|
||||
# ensure that initialization has completed
|
||||
asset-hub-zagros-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/wait-hrmp-channel-opened.js with "1002" within 600 seconds
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
Description: Check if the Zagros teyrchains started producing blocks reliably
|
||||
Network: ./bridge_hub_zagros_local_network.toml
|
||||
Creds: config
|
||||
|
||||
# ensure that initialization has completed
|
||||
asset-hub-zagros-collator1: reports block height is at least 10 within 180 seconds
|
||||
bridge-hub-zagros-collator1: reports block height is at least 10 within 180 seconds
|
||||
|
||||
Reference in New Issue
Block a user