mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 23:21:02 +00:00
807db6ff0d
* changes to read json spec in test binary
* add zombienet tests
* fmt
* use {{COL_IMAGE}} and clean config
* add comment and use relay image from env
* use test-parachain image from pr
* fix warns
* fix warns
* fmt
* typo
* fix ci to use zombienet image
* fix spawn nodes for test
* reorg test
* add within to test
* remove check for full node collators is up
* add tests for pov, mirate solo to para, sync blocks
* bump zombienet image
* add job dep with artifacts
* add sleep for test
* fix after merge
* fmt
* bump zombienet version
* changes from clap
* use base/shared params
* fmt
* debug ci
* add upgrade test
* update js test for debug
* less debug in test
* print assertion
* fix upgrade test
* Collator key only needed if we run as collator
* [Fix] Benchmark build artifact folder creation (#1518)
* Trivial networking changes for Substrate PR #11940 (#1486)
* Trivial networking changes for Substrate PR https://github.com/paritytech/substrate/pull/11940
* Apply formatting rules
* update lockfile for {"polkadot", "substrate"}
Co-authored-by: parity-processbot <>
* bump zombienet version
* update network def for test
* typo
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
Co-authored-by: Roman Useinov <roman.useinov@gmail.com>
Co-authored-by: Nazar Mokrynskyi <nazar@mokrynskyi.com>
57 lines
2.0 KiB
JavaScript
57 lines
2.0 KiB
JavaScript
const assert = require("assert");
|
|
const polkadotApi = require("@polkadot/api");
|
|
const utilCrypto = require("@polkadot/util-crypto");
|
|
const fs = require("fs").promises;
|
|
|
|
async function connect(apiUrl, types) {
|
|
const provider = new polkadotApi.WsProvider(apiUrl);
|
|
const api = new polkadotApi.ApiPromise({ provider, types });
|
|
await api.isReady;
|
|
return api;
|
|
}
|
|
|
|
async function run(nodeName, networkInfo, args) {
|
|
const [paraNode, partialPath, soloNode ] = args;
|
|
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[paraNode];
|
|
const {wsUri: wsUri_solo, userDefinedTypes: userDefinedTypes_solo } = networkInfo.nodesByName[soloNode];
|
|
const para = await connect(wsUri, userDefinedTypes);
|
|
const solo = await connect(wsUri_solo, userDefinedTypes_solo);
|
|
|
|
await utilCrypto.cryptoWaitReady();
|
|
|
|
// account to submit tx
|
|
const keyring = new polkadotApi.Keyring({ type: "sr25519" });
|
|
const alice = keyring.addFromUri("//Alice");
|
|
|
|
// get genesis to update
|
|
const filePath = `${networkInfo.tmpDir}/${partialPath}/genesis-state`;
|
|
const customHeader = await fs.readFile(filePath);
|
|
|
|
// get current header
|
|
await para.tx.testPallet.setCustomValidationHeadData(customHeader.toString()).signAndSend(alice);
|
|
|
|
let parachain_best;
|
|
let count = 0;
|
|
|
|
assertParachainBest = async (parachain_best) => {
|
|
const current = await para.rpc.chain.getHeader();
|
|
assert.equal(parachain_best.toHuman().number, current.toHuman().number, "parachain should not produce more blocks");
|
|
}
|
|
|
|
|
|
await new Promise( async (resolve, reject) => {
|
|
const unsubscribe = await solo.rpc.chain.subscribeNewHeads(async (header) => {
|
|
console.log(`Solo chain is at block: #${header.number}`);
|
|
count++;
|
|
if(count === 2) parachain_best = await para.rpc.chain.getHeader();
|
|
|
|
if(count > 4) {
|
|
unsubscribe();
|
|
await assertParachainBest(parachain_best);
|
|
resolve();
|
|
}
|
|
});
|
|
});
|
|
}
|
|
|
|
module.exports = { run } |