90fd044766
- snowbridge-pezpallet-* → pezsnowbridge-pezpallet-* (201 refs) - pallet/ directories → pezpallet/ (4 locations) - Fixed pezpallet.rs self-include recursion bug - Fixed sc-chain-spec hardcoded crate name in derive macro - Reverted .pezpallet_by_name() to .pallet_by_name() (subxt API) - Added BizinikiwiConfig type alias for zombienet tests - Deleted obsolete session state files Verified: pezsnowbridge-pezpallet-*, pezpallet-staking, pezpallet-staking-async, pezframe-benchmarking-cli all pass cargo check
35 lines
1.3 KiB
JavaScript
35 lines
1.3 KiB
JavaScript
const utils = require("./utils");
|
|
|
|
async function run(nodeName, networkInfo, args) {
|
|
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
|
|
const api = await zombie.connect(wsUri, userDefinedTypes);
|
|
|
|
// parse arguments
|
|
const exitAfterSeconds = Number(args[0]);
|
|
const bridgedChain = require("./chains/" + args[1]);
|
|
|
|
// start listening to new blocks
|
|
let totalGrandpaHeaders = 0;
|
|
let totalTeyrchainHeaders = 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.countGrandpaHeaderImports(bridgedChain, currentEvents);
|
|
totalTeyrchainHeaders += await utils.countTeyrchainHeaderImports(bridgedChain, currentEvents);
|
|
});
|
|
|
|
// wait given time
|
|
await new Promise(resolve => setTimeout(resolve, exitAfterSeconds * 1000));
|
|
// if we haven't seen many (>1) new GRANDPA or teyrchain headers => fail
|
|
if (totalGrandpaHeaders <= 1) {
|
|
throw new Error("No bridged relay chain headers imported");
|
|
}
|
|
if (totalTeyrchainHeaders <= 1) {
|
|
throw new Error("No bridged teyrchain headers imported");
|
|
}
|
|
}
|
|
|
|
module.exports = { run }
|