Skip to content

Commit

Permalink
Some fixes for zombienet tests (polkadot-staging) (#2704)
Browse files Browse the repository at this point in the history
* renamed test file

* wait until HRMP channel is opened
  • Loading branch information
svyatonik committed Nov 15, 2023
1 parent 6f9a147 commit 4916475
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
22 changes: 22 additions & 0 deletions zombienet/helpers/wait-hrmp-channel-opened.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
async function run(nodeName, networkInfo, args) {
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
const api = await zombie.connect(wsUri, userDefinedTypes);

const sibling = args[0];

while (true) {
const messagingStateAsObj = await api.query.parachainSystem.relevantMessagingState();
const messagingState = api.createType("Option<CumulusPalletParachainSystemRelayStateSnapshotMessagingStateSnapshot>", messagingStateAsObj);
if (messagingState.isSome) {
const egressChannels = messagingState.unwrap().egressChannels;
if (egressChannels.find(x => x[0] == sibling)) {
return;
}
}

// else sleep and retry
await new Promise((resolve) => setTimeout(resolve, 12000));
}
}

module.exports = { run }
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Creds: config

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

# step 2: initialize Westend bridge hub
bridge-hub-westend-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-westend-local" within 120 seconds
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Creds: config

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

# step 2: initialize Rococo bridge hub
bridge-hub-rococo-collator1: run ../scripts/invoke-script.sh with "init-bridge-hub-rococo-local" within 120 seconds
Expand Down

0 comments on commit 4916475

Please sign in to comment.