Skip to content

Commit

Permalink
Bump bridges relay version + uncomment bridges zombeinet tests (parit…
Browse files Browse the repository at this point in the history
…ytech#4289)

TODOs:
- [x] wait and see if test `1` works;
- [x] ~think of whether we need remaining tests.~ I think we should keep
it - will try to revive and update it
  • Loading branch information
svyatonik authored Apr 26, 2024
1 parent e8f7c81 commit c66d8a8
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 38 deletions.
4 changes: 1 addition & 3 deletions .gitlab/pipeline/zombienet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,4 @@ include:
# polkadot tests
- .gitlab/pipeline/zombienet/polkadot.yml
# bridges tests
# TODO: https://github.com/paritytech/parity-bridges-common/pull/2884
# commenting until we have a new relatye, compatible with updated fees scheme
# - .gitlab/pipeline/zombienet/bridges.yml
- .gitlab/pipeline/zombienet/bridges.yml
4 changes: 2 additions & 2 deletions .gitlab/pipeline/zombienet/bridges.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,9 @@ zombienet-bridges-0001-asset-transfer-works:
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0001-asset-transfer --docker
- echo "Done"

zombienet-bridges-0002-mandatory-headers-synced-while-idle:
zombienet-bridges-0002-free-headers-synced-while-idle:
extends:
- .zombienet-bridges-common
script:
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0002-mandatory-headers-synced-while-idle --docker
- /home/nonroot/bridges-polkadot-sdk/bridges/testing/run-new-test.sh 0002-free-headers-synced-while-idle --docker
- echo "Done"
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,23 @@ async function run(nodeName, networkInfo, args) {

// start listening to new blocks
let totalGrandpaHeaders = 0;
let initialParachainHeaderImported = false;
let totalParachainHeaders = 0;
api.rpc.chain.subscribeNewHeads(async function (header) {
const apiAtParent = await api.at(header.parentHash);
const apiAtCurrent = await api.at(header.hash);
const currentEvents = await apiAtCurrent.query.system.events();

totalGrandpaHeaders += await utils.ensureOnlyMandatoryGrandpaHeadersImported(
bridgedChain,
apiAtParent,
apiAtCurrent,
currentEvents,
);
initialParachainHeaderImported = await utils.ensureOnlyInitialParachainHeaderImported(
bridgedChain,
apiAtParent,
apiAtCurrent,
currentEvents,
);
totalGrandpaHeaders += await utils.countGrandpaHeaderImports(bridgedChain, currentEvents);
totalParachainHeaders += await utils.countParachainHeaderImports(bridgedChain, currentEvents);
});

// wait given time
await new Promise(resolve => setTimeout(resolve, exitAfterSeconds * 1000));
// if we haven't seen any new GRANDPA or parachain headers => fail
if (totalGrandpaHeaders == 0) {
// if we haven't seen many (>1) new GRANDPA or parachain headers => fail
if (totalGrandpaHeaders <= 1) {
throw new Error("No bridged relay chain headers imported");
}
if (!initialParachainHeaderImported) {
if (totalParachainHeaders <= 1) {
throw new Error("No bridged parachain headers imported");
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Description: While relayer is idle, we only sync free Rococo (and a single Rococo BH) headers to Westend BH.
Network: {{ENV_PATH}}/bridge_hub_westend_local_network.toml
Creds: config

# local chain spec gives `1u64 << 60` tokens to every endowed account: if it'll ever
# change, it'd need to be fixed here as well

# //Charlie only submits free and mandatory relay chain headers, so the balance should stay the same
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y" return is 1152921504606846976 within 30 seconds
# //Dave only submits free parachain headers, so the balance should stay the same
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy" return is 1152921504606846976 within 30 seconds

# ensure that we have synced multiple relay and parachain headers while idle. This includes both
# headers that were generated while relay was offline and those in the next 100 seconds while script is active.
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/multiple-headers-synced.js with "300,rococo-at-westend" within 600 seconds

# //Charlie only submits free and mandatory relay chain headers, so the balance should stay the same
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y" return is 1152921504606846976 within 30 seconds
# //Dave only submits free parachain headers, so the balance should stay the same
bridge-hub-westend-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy" return is 1152921504606846976 within 30 seconds
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ echo
# which is expected to be 60 seconds for the test environment.
echo -e "Sleeping 90s before starting relayer ...\n"
sleep 90
${BASH_SOURCE%/*}/../../environments/rococo-westend/start_relayer.sh $rococo_dir $westend_dir relayer_pid
${BASH_SOURCE%/*}/../../environments/rococo-westend/start_relayer.sh $rococo_dir $westend_dir finality_relayer_pid parachains_relayer_pid messages_relayer_pid

run_zndsl ${BASH_SOURCE%/*}/rococo-to-westend.zndsl $westend_dir
run_zndsl ${BASH_SOURCE%/*}/westend-to-rococo.zndsl $rococo_dir
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Description: While relayer is idle, we only sync free Westend (and a single Westend BH) headers to Rococo BH.
Network: {{ENV_PATH}}/bridge_hub_rococo_local_network.toml
Creds: config

# local chain spec gives `1u64 << 60` tokens to every endowed account: if it'll ever
# change, it'd need to be fixed here as well

# //Charlie has inital balance
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y" return is 1152921504606846976 within 30 seconds
# //Dave has inital balance
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy" return is 1152921504606846976 within 30 seconds

# ensure that we have synced multiple relay and parachain headers while idle. This includes both
# headers that were generated while relay was offline and those in the next 100 seconds while script is active.
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/multiple-headers-synced.js with "300,westend-at-rococo" within 600 seconds

# //Charlie only submits free and mandatory relay chain headers, so the balance should stay the same
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y" return is 1152921504606846976 within 30 seconds
# //Dave only submits free parachain headers, so the balance should stay the same
bridge-hub-rococo-collator1: js-script {{FRAMEWORK_PATH}}/js-helpers/native-asset-balance.js with "5DAAnrj7VHTznn2AWBemMuyBwZWs6FNFjdyVXUeYum3PTXFy" return is 1152921504606846976 within 30 seconds

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# this image is built on top of existing Zombienet image
ARG ZOMBIENET_IMAGE
# this image uses substrate-relay image built elsewhere
ARG SUBSTRATE_RELAY_IMAGE=docker.io/paritytech/substrate-relay:v1.2.1
ARG SUBSTRATE_RELAY_IMAGE=docker.io/paritytech/substrate-relay:v1.5.0

# metadata
ARG VCS_REF
Expand Down

0 comments on commit c66d8a8

Please sign in to comment.