Files
pezkuwi-subxt/zombienet_tests/runtime_upgrade.js
T
Javier Viola 725d00753e Zombienet add tests (#1321)
* 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>
2022-08-18 17:59:36 +02:00

24 lines
1.1 KiB
JavaScript

const assert = require("assert");
async function run(nodeName, networkInfo, args) {
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
const api = await zombie.connect(wsUri, userDefinedTypes);
// get blockhash/runtimeVersion at block 1
const hashAtBlock1 = await api.rpc.chain.getBlockHash(1);
const versionAtBlock1 = await api.rpc.state.getRuntimeVersion(hashAtBlock1.toHuman());
// get blockhash/runtimeVersion at current head
const currentHeader = await api.rpc.chain.getHeader();
const hashAtCurrent = await api.rpc.chain.getBlockHash(currentHeader.number.toHuman());
const versionAtCurrent = await api.rpc.state.getRuntimeVersion(hashAtCurrent.toHuman());
const oldVersionIncremented = parseInt(versionAtBlock1.specVersion.toHuman(),10) + 1;
console.log("current", versionAtCurrent.specVersion.toHuman());
console.log("oldVersionIncremented", oldVersionIncremented);
// 2 == 2
assert.equal( oldVersionIncremented, versionAtCurrent.specVersion.toHuman(), "Running version should be the incremented version");
}
module.exports = { run }