Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bridges patch applied for stable2409 #519

Open
wants to merge 17 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
489 changes: 247 additions & 242 deletions Cargo.lock

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ asset-hub-kusama-emulated-chain = { path = "integration-tests/emulated/chains/pa
asset-hub-kusama-runtime = { path = "system-parachains/asset-hubs/asset-hub-kusama" }
asset-hub-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/assets/asset-hub-polkadot" }
asset-hub-polkadot-runtime = { path = "system-parachains/asset-hubs/asset-hub-polkadot" }
asset-test-utils = { version = "18.0.0" }
asset-test-utils = { version = "20.0.0" }
assets-common = { version = "0.18.0", default-features = false }
authority-discovery-primitives = { version = "34.0.0", default-features = false, package = "sp-authority-discovery" }
babe-primitives = { version = "0.40.0", default-features = false, package = "sp-consensus-babe" }
Expand All @@ -32,14 +32,14 @@ bp-polkadot-bulletin = { version = "0.15.0", default-features = false }
bp-polkadot-core = { version = "0.18.0", default-features = false }
bp-relayers = { version = "0.18.0", default-features = false }
bp-runtime = { version = "0.18.0", default-features = false }
bp-xcm-bridge-hub = { version = "0.4.0", default-features = false }
bp-xcm-bridge-hub = { version = "0.4.2", default-features = false }
bp-xcm-bridge-hub-router = { version = "0.14.1", default-features = false }
bridge-hub-common = { version = "0.10.0", default-features = false }
bridge-hub-kusama-emulated-chain = { path = "integration-tests/emulated/chains/parachains/bridges/bridge-hub-kusama" }
bridge-hub-kusama-runtime = { path = "system-parachains/bridge-hubs/bridge-hub-kusama" }
bridge-hub-polkadot-emulated-chain = { path = "integration-tests/emulated/chains/parachains/bridges/bridge-hub-polkadot" }
bridge-hub-polkadot-runtime = { path = "system-parachains/bridge-hubs/bridge-hub-polkadot" }
bridge-hub-test-utils = { version = "0.18.0" }
bridge-hub-test-utils = { version = "0.20.0" }
bridge-runtime-common = { version = "0.18.0", default-features = false }
clap = { version = "4.5.0" }
codec = { package = "parity-scale-codec", version = "3.6.9", default-features = false }
Expand All @@ -58,7 +58,7 @@ cumulus-pallet-xcmp-queue = { version = "0.17.0", default-features = false }
cumulus-primitives-aura = { version = "0.15.0", default-features = false }
cumulus-primitives-core = { version = "0.16.0", default-features = false }
cumulus-primitives-utility = { version = "0.17.0", default-features = false }
emulated-integration-tests-common = { version = "14.1.0" }
emulated-integration-tests-common = { version = "16.0.0" }
encointer-balances-tx-payment = { version = "~14.1.0", default-features = false }
encointer-balances-tx-payment-rpc-runtime-api = { version = "~14.1.0", default-features = false }
encointer-kusama-runtime = { path = "system-parachains/encointer" }
Expand Down Expand Up @@ -169,11 +169,11 @@ pallet-vesting = { version = "38.0.0", default-features = false }
pallet-whitelist = { version = "37.0.0", default-features = false }
pallet-xcm = { version = "17.0.0", default-features = false }
pallet-xcm-benchmarks = { version = "17.0.0", default-features = false }
pallet-xcm-bridge-hub = { version = "0.13.0", default-features = false }
pallet-xcm-bridge-hub-router = { version = "0.15.1", default-features = false }
pallet-xcm-bridge-hub = { version = "0.13.2", default-features = false }
pallet-xcm-bridge-hub-router = { version = "0.15.3", default-features = false }
parachain-info = { version = "0.17.0", default-features = false, package = "staging-parachain-info" }
parachains-common = { version = "18.0.0", default-features = false }
parachains-runtimes-test-utils = { version = "17.0.0" }
parachains-runtimes-test-utils = { version = "19.0.0" }
paste = { version = "1.0.14" }
penpal-emulated-chain = { path = "integration-tests/emulated/chains/parachains/testing/penpal" }
penpal-runtime = { version = "0.25.0" }
Expand Down Expand Up @@ -211,7 +211,7 @@ snowbridge-pallet-outbound-queue = { version = "0.10.0", default-features = fals
snowbridge-pallet-system = { version = "0.10.0", default-features = false }
snowbridge-router-primitives = { version = "0.16.0", default-features = false }
snowbridge-runtime-common = { version = "0.10.0", default-features = false }
snowbridge-runtime-test-common = { version = "0.10.0" }
snowbridge-runtime-test-common = { version = "0.12.0" }
snowbridge-system-runtime-api = { version = "0.10.0", default-features = false }
sp-api = { version = "34.0.0", default-features = false }
sp-application-crypto = { version = "38.0.0", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ ON_BRIDGE_HUB_KUSAMA_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhpd_ThisChain="EoQBtnw
ON_BRIDGE_HUB_KUSAMA_SOVEREIGN_ACCOUNT_FOR_LANE_00000001_bhpd_BridgedChain="EoQBtnwp4jMtCEpV7CPsssT6bdDHuHZmf3aGXxHJiSA4Dz3"

LANE_ID="00000001"
XCM_VERSION=3
XCM_VERSION=4

AHK_DOT_ED=10000000
DOT=10000000000
Expand Down Expand Up @@ -193,12 +193,99 @@ function run_relay() {
--lane "${LANE_ID}"
}

function run_finality_relay() {
local relayer_path=$(ensure_relayer)

RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-headers polkadot-to-bridge-hub-kusama \
--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 kusama-to-bridge-hub-polkadot \
--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_parachains_relay() {
local relayer_path=$(ensure_relayer)

RUST_LOG=runtime=trace,rpc=trace,bridge=trace \
$relayer_path relay-parachains polkadot-to-bridge-hub-kusama \
--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-parachains kusama-to-bridge-hub-polkadot \
--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-polkadot-to-bridge-hub-kusama \
--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-kusama-to-bridge-hub-polkadot \
--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-relay)
init_kusama_polkadot
init_polkadot_kusama
run_relay
;;
run-finality-relay)
init_kusama_polkadot
init_polkadot_kusama
run_finality_relay
;;
run-parachains-relay)
run_parachains_relay
;;
run-messages-relay)
run_messages_relay
;;
init-asset-hub-polkadot-local)
ensure_polkadot_js_api
# create foreign assets for native Kusama token (governance call on Polkadot)
Expand All @@ -207,7 +294,7 @@ case "$1" in
"//Alice" \
1000 \
"ws://127.0.0.1:9910" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Kusama" } } }')" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Kusama" } ] } }')" \
"$GLOBAL_CONSENSUS_KUSAMA_SOVEREIGN_ACCOUNT" \
$AHP_KSM_ED \
true
Expand Down Expand Up @@ -266,7 +353,7 @@ case "$1" in
"//Alice" \
1000 \
"ws://127.0.0.1:9010" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": { "GlobalConsensus": "Polkadot" } } }')" \
"$(jq --null-input '{ "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Polkadot" } ] } }')" \
"$GLOBAL_CONSENSUS_POLKADOT_SOVEREIGN_ACCOUNT" \
$AHK_DOT_ED \
true
Expand Down Expand Up @@ -323,9 +410,9 @@ case "$1" in
limited_reserve_transfer_assets \
"ws://127.0.0.1:9910" \
"//Alice" \
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V3": { "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 '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": '$amount' } } ] }')" \
"$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V4": { "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 '{ "V4": [ { "id": { "parents": 1, "interior": "Here" }, "fun": { "Fungible": '$amount' } } ] }')" \
0 \
"Unlimited"
;;
Expand All @@ -336,9 +423,9 @@ case "$1" in
limited_reserve_transfer_assets \
"ws://127.0.0.1:9910" \
"//Alice" \
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V3": { "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 '{ "V3": [ { "id": { "Concrete": { "parents": 2, "interior": { "X1": { "GlobalConsensus": "Kusama" } } } }, "fun": { "Fungible": '$amount' } } ] }')" \
"$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Kusama" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V4": { "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 '{ "V4": [ { "id": { "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Kusama" } ] } }, "fun": { "Fungible": '$amount' } } ] }')" \
0 \
"Unlimited"
;;
Expand All @@ -349,9 +436,9 @@ case "$1" in
limited_reserve_transfer_assets \
"ws://127.0.0.1:9010" \
"//Alice" \
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V3": { "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 '{ "V3": [ { "id": { "Concrete": { "parents": 1, "interior": "Here" } }, "fun": { "Fungible": '$amount' } } ] }')" \
"$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V4": { "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 '{ "V4": [ { "id": { "parents": 1, "interior": "Here" }, "fun": { "Fungible": '$amount' } } ] }')" \
0 \
"Unlimited"
;;
Expand All @@ -362,16 +449,19 @@ case "$1" in
limited_reserve_transfer_assets \
"ws://127.0.0.1:9010" \
"//Alice" \
"$(jq --null-input '{ "V3": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V3": { "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 '{ "V3": [ { "id": { "Concrete": { "parents": 2, "interior": { "X1": { "GlobalConsensus": "Polkadot" } } } }, "fun": { "Fungible": '$amount' } } ] }')" \
"$(jq --null-input '{ "V4": { "parents": 2, "interior": { "X2": [ { "GlobalConsensus": "Polkadot" }, { "Parachain": 1000 } ] } } }')" \
"$(jq --null-input '{ "V4": { "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 '{ "V4": [ { "id": { "parents": 2, "interior": { "X1": [ { "GlobalConsensus": "Polkadot" } ] } }, "fun": { "Fungible": '$amount' } } ] }')" \
0 \
"Unlimited"
;;
*)
echo "A command is require. Supported commands for:
Local (zombienet) run:
- run-relay
- run-finality-relay
- run-parachains-relay
- run-messages-relay
- init-asset-hub-polkadot-local
- init-bridge-hub-polkadot-local
- init-asset-hub-kusama-local
Expand Down
60 changes: 39 additions & 21 deletions integration-tests/bridges/environments/polkadot-kusama/spawn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,23 @@ 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"

Expand All @@ -17,33 +34,34 @@ kusama_def=${BASH_SOURCE%/*}/bridge_hub_kusama_local_network.toml
start_zombienet $TEST_DIR $kusama_def kusama_dir kusama_pid
echo

polkadot_init_log=$logs_dir/polkadot-init.log
echo -e "Setting up the polkadot side of the bridge. Logs available at: $polkadot_init_log\n"

kusama_init_log=$logs_dir/kusama-init.log
echo -e "Setting up the kusama side of the bridge. Logs available at: $kusama_init_log\n"

$helper_script init-asset-hub-polkadot-local >> $polkadot_init_log 2>&1 &
polkadot_init_pid=$!
$helper_script init-asset-hub-kusama-local >> $kusama_init_log 2>&1 &
kusama_init_pid=$!
wait -n $polkadot_init_pid $kusama_init_pid

if [[ $init -eq 1 ]]; then
polkadot_init_log=$logs_dir/polkadot-init.log
echo -e "Setting up the polkadot side of the bridge. Logs available at: $polkadot_init_log\n"
kusama_init_log=$logs_dir/kusama-init.log
echo -e "Setting up the kusama side of the bridge. Logs available at: $kusama_init_log\n"
$helper_script init-asset-hub-polkadot-local >> $polkadot_init_log 2>&1 &
polkadot_init_pid=$!
$helper_script init-asset-hub-kusama-local >> $kusama_init_log 2>&1 &
kusama_init_pid=$!
wait -n $polkadot_init_pid $kusama_init_pid

$helper_script init-bridge-hub-polkadot-local >> $polkadot_init_log 2>&1 &
polkadot_init_pid=$!
$helper_script init-bridge-hub-kusama-local >> $kusama_init_log 2>&1 &
kusama_init_pid=$!
wait -n $polkadot_init_pid $kusama_init_pid
$helper_script init-bridge-hub-polkadot-local >> $polkadot_init_log 2>&1 &
polkadot_init_pid=$!
$helper_script init-bridge-hub-kusama-local >> $kusama_init_log 2>&1 &
kusama_init_pid=$!
wait -n $polkadot_init_pid $kusama_init_pid

run_zndsl ${BASH_SOURCE%/*}/polkadot-init.zndsl $polkadot_dir
run_zndsl ${BASH_SOURCE%/*}/kusama-init.zndsl $kusama_dir
run_zndsl ${BASH_SOURCE%/*}/polkadot-init.zndsl $polkadot_dir
run_zndsl ${BASH_SOURCE%/*}/kusama-init.zndsl $kusama_dir
fi

${BASH_SOURCE%/*}/start_relayer.sh $polkadot_dir $kusama_dir relayer_pid
if [[ $start_relayer -eq 1 ]]; then
${BASH_SOURCE%/*}/start_relayer.sh $polkadot_dir $kusama_dir finality_relayer_pid parachains_relayer_pid messages_relayer_pid
fi

echo $polkadot_dir > $TEST_DIR/polkadot.env
echo $kusama_dir > $TEST_DIR/kusama.env
echo

wait -n $polkadot_pid $kusama_pid $relayer_pid
wait -n $polkadot_pid $kusama_pid $finality_relayer_pid $parachains_relayer_pid $messages_relayer_pid
kill -9 -$$
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,31 @@ source "$FRAMEWORK_PATH/utils/zombienet.sh"

polkadot_dir=$1
kusama_dir=$2
__relayer_pid=$3
__finality_relayer_pid=$3
__parachains_relayer_pid=$4
__messages_relayer_pid=$5

logs_dir=$TEST_DIR/logs
helper_script="${BASH_SOURCE%/*}/helper.sh"

relayer_log=$logs_dir/relayer.log
echo -e "Starting polkadot-kusama relayer. Logs available at: $relayer_log\n"
start_background_process "$helper_script run-relay" $relayer_log relayer_pid
# start finality relayer
finality_relayer_log=$logs_dir/relayer_finality.log
echo -e "Starting polkadot-kusama finality relayer. Logs available at: $finality_relayer_log\n"
start_background_process "$helper_script run-finality-relay" $finality_relayer_log finality_relayer_pid

# start parachains relayer
parachains_relayer_log=$logs_dir/relayer_parachains.log
echo -e "Starting polkadot-kusama parachains relayer. Logs available at: $parachains_relayer_log\n"
start_background_process "$helper_script run-parachains-relay" $parachains_relayer_log parachains_relayer_pid

# start messages relayer
messages_relayer_log=$logs_dir/relayer_messages.log
echo -e "Starting polkadot-kusama 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%/*}/polkadot-bridge.zndsl $polkadot_dir
run_zndsl ${BASH_SOURCE%/*}/kusama-bridge.zndsl $kusama_dir

eval $__relayer_pid="'$relayer_pid'"

eval $__finality_relayer_pid="'$finality_relayer_pid'"
eval $__parachains_relayer_pid="'$parachains_relayer_pid'"
eval $__messages_relayer_pid="'$messages_relayer_pid'"
Loading
Loading