Skip to content

Commit 9a111fd

Browse files
authored
Bridges update subtree (#2625)
1 parent c046a9d commit 9a111fd

File tree

7 files changed

+70
-23
lines changed

7 files changed

+70
-23
lines changed

Cargo.lock

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bridges/primitives/test-utils/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ bp-parachains = { path = "../parachains", default-features = false }
1212
bp-polkadot-core = { path = "../polkadot-core", default-features = false }
1313
bp-runtime = { path = "../runtime", default-features = false }
1414
codec = { package = "parity-scale-codec", version = "3.1.5", default-features = false }
15-
ed25519-dalek = { version = "2.0", default-features = false }
15+
ed25519-dalek = { version = "2.1", default-features = false }
1616
finality-grandpa = { version = "0.16.2", default-features = false }
1717
sp-application-crypto = { path = "../../../substrate/primitives/application-crypto", default-features = false }
1818
sp-consensus-grandpa = { path = "../../../substrate/primitives/consensus/grandpa", default-features = false }
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
async function run(nodeName, networkInfo, args) {
2+
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
3+
const api = await zombie.connect(wsUri, userDefinedTypes);
4+
5+
const accountAddress = args[0];
6+
const initialAccountData = await api.query.system.account(accountAddress);
7+
const initialAccountBalance = initialAccountData.data['free'];
8+
while (true) {
9+
const accountData = await api.query.system.account(accountAddress);
10+
const accountBalance = accountData.data['free'];
11+
if (accountBalance > initialAccountBalance) {
12+
return accountBalance;
13+
}
14+
15+
// else sleep and retry
16+
await new Promise((resolve) => setTimeout(resolve, 12000));
17+
}
18+
}
19+
20+
module.exports = { run }

bridges/zombienet/run-tests.sh

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ export POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_ROCOCO=$POLKADOT_PARACHAIN_B
1414
export POLKADOT_PARACHAIN_BINARY_PATH_FOR_ASSET_HUB_WESTEND=$POLKADOT_PARACHAIN_BINARY_PATH
1515
export ZOMBIENET_BINARY_PATH=~/local_bridge_testing/bin/zombienet-linux
1616

17+
# check if `wait` supports -p flag
18+
if [ `printf "$BASH_VERSION\n5.1" | sort -V | head -n 1` = "5.1" ]; then IS_BASH_5_1=1; else IS_BASH_5_1=0; fi
19+
1720
# bridge configuration
1821
export LANE_ID="00000002"
1922

@@ -66,12 +69,19 @@ do
6669
# wait until all tests are completed
6770
relay_exited=0
6871
for n in `seq 1 $TEST_COPROCS_COUNT`; do
69-
wait -n -p COPROC_PID
70-
exit_code=$?
71-
coproc_name=${TEST_COPROCS[$COPROC_PID, 0]}
72-
coproc_log=${TEST_COPROCS[$COPROC_PID, 1]}
73-
coproc_stdout=$(cat $coproc_log)
74-
relay_exited=$(expr "${coproc_name}" == "relay")
72+
if [ "$IS_BASH_5_1" -eq 1 ]; then
73+
wait -n -p COPROC_PID
74+
exit_code=$?
75+
coproc_name=${TEST_COPROCS[$COPROC_PID, 0]}
76+
coproc_log=${TEST_COPROCS[$COPROC_PID, 1]}
77+
coproc_stdout=$(cat $coproc_log)
78+
relay_exited=$(expr "${coproc_name}" == "relay")
79+
else
80+
wait -n
81+
exit_code=$?
82+
coproc_name="<unknown>"
83+
coproc_stdout="<unknown>"
84+
fi
7585
echo "Process $coproc_name has finished with exit code: $exit_code"
7686

7787
# if exit code is not zero, exit
Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub
1+
Description: User is able to transfer ROC from Rococo Asset Hub to Westend Asset Hub and back
22
Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_westend_local_network.toml
33
Creds: config
44

5-
# step 1: initialize Westend asset hub
5+
# step 1: initialize Westend AH
66
asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-westend-local" within 240 seconds
77
asset-hub-westend-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1002" within 400 seconds
88

@@ -12,15 +12,23 @@ bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-
1212
# step 3: relay is started elsewhere - let's wait until with-Rococo GRANPDA pallet is initialized at Westend
1313
bridge-hub-westend-collator1: js-script ../helpers/best-finalized-header-at-bridged-chain.js with "Rococo,0" within 400 seconds
1414

15-
# step 2: send WOC to Rococo
15+
# step 4: send WND to //Alice on Rococo AH
16+
# (that's a required part of a sibling 0001-asset-transfer-works-westend-to-rococo.zndsl test)
1617
asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-westend-local" within 60 seconds
1718

18-
# step 3: elsewhere Rococo has sent ROC to //Alice - let's wait for it
19+
# step 5: elsewhere Rococo has sent ROC to //Alice - let's wait for it
1920
asset-hub-westend-collator1: js-script ../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Rococo" within 600 seconds
2021

21-
# step 4: check that the relayer //Charlie is rewarded by both our AH and target AH
22+
# step 6: check that the relayer //Charlie is rewarded by both our AH and target AH
2223
bridge-hub-westend-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726f,BridgedChain,0" within 300 seconds
2324
bridge-hub-westend-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x6268726F,ThisChain,0" within 300 seconds
2425

26+
# step 7: send wROC back to Alice at Rococo AH
27+
asset-hub-westend-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-westend-local" within 60 seconds
28+
29+
# step 8: elsewhere Rococo has sent wWND to //Alice - let's wait for it
30+
# (we wait until //Alice account increases here - there are no other transactionc that may increase it)
31+
asset-hub-westend-collator1: js-script ../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 600 seconds
32+
2533
# wait until other network test has completed OR exit with an error too
2634
asset-hub-westend-collator1: run ../scripts/sync-exit.sh within 600 seconds
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
Description: User is able to transfer WOC from Westend Asset Hub to Rococo Asset Hub
1+
Description: User is able to transfer WND from Westend Asset Hub to Rococo Asset Hub and back
22
Network: ../../../cumulus/zombienet/bridge-hubs/bridge_hub_rococo_local_network.toml
33
Creds: config
44

5-
# step 1: initialize Rococo asset hub
5+
# step 1: initialize Rococo AH
66
asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-asset-hub-rococo-local" within 240 seconds
77
asset-hub-rococo-collator1: js-script ../helpers/wait-hrmp-channel-opened.js with "1013" within 400 seconds
88

@@ -12,15 +12,23 @@ bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-h
1212
# step 3: relay is started elsewhere - let's wait until with-Westend GRANPDA pallet is initialized at Rococo
1313
bridge-hub-rococo-collator1: js-script ../helpers/best-finalized-header-at-bridged-chain.js with "Westend,0" within 400 seconds
1414

15-
# step 4: send ROC to Westend
15+
# step 4: send ROC to //Alice on Westend AH
16+
# (that's a required part of a sibling 0001-asset-transfer-works-rococo-to-westend.zndsl test)
1617
asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "reserve-transfer-assets-from-asset-hub-rococo-local" within 60 seconds
1718

18-
# step 5: elsewhere Westend has sent WOC to //Alice - let's wait for it
19+
# step 5: elsewhere Westend has sent WND to //Alice - let's wait for it
1920
asset-hub-rococo-collator1: js-script ../helpers/wrapped-assets-balance.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY,0,Westend" within 600 seconds
2021

2122
# step 6: check that the relayer //Charlie is rewarded by both our AH and target AH
2223
bridge-hub-rococo-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,BridgedChain,0" within 300 seconds
2324
bridge-hub-rococo-collator1: js-script ../helpers/relayer-rewards.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y,0x00000002,0x62687764,ThisChain,0" within 300 seconds
2425

26+
# step 7: send wWND back to Alice at Westend AH
27+
asset-hub-rococo-collator1: run ../scripts/invoke-script.sh with "withdraw-reserve-assets-from-asset-hub-rococo-local" within 60 seconds
28+
29+
# step 8: elsewhere Westend has sent wROC to //Alice - let's wait for it
30+
# (we wait until //Alice account increases here - there are no other transactionc that may increase it)
31+
asset-hub-rococo-collator1: js-script ../helpers/native-assets-balance-increased.js with "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY" within 600 seconds
32+
2533
# wait until other network test has completed OR exit with an error too
2634
asset-hub-rococo-collator1: run ../scripts/sync-exit.sh within 600 seconds

substrate/client/authority-discovery/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ futures-timer = "3.0.1"
2323
ip_network = "0.4.1"
2424
libp2p = { version = "0.51.3", features = ["ed25519", "kad"] }
2525
multihash = { version = "0.18.1", default-features = false, features = [
26-
"sha2",
27-
"std",
26+
"sha2",
27+
"std",
2828
] }
2929
log = "0.4.17"
3030
prost = "0.11"
@@ -41,9 +41,9 @@ sp-keystore = { path = "../../primitives/keystore" }
4141
sp-runtime = { path = "../../primitives/runtime" }
4242
async-trait = "0.1.56"
4343
multihash-codetable = { version = "0.1.1", features = [
44-
"serde",
45-
"sha2",
46-
"digest",
44+
"digest",
45+
"serde",
46+
"sha2",
4747
] }
4848

4949
[dev-dependencies]

0 commit comments

Comments
 (0)