mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 19:51:02 +00:00
[Zombienet] test deregister validator (#5718)
* Update metric name and doc Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * add test and rename metric to use * change within time for test * Update .gitlab-ci.yml Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> * Update .gitlab-ci.yml Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> * Properly format the stash account Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * Update test Signed-off-by: Andrei Sandu <andrei-mihail@parity.io> * change metric name * Bump quote from 1.0.19 to 1.0.20 (#5736) Bumps [quote](https://github.com/dtolnay/quote) from 1.0.19 to 1.0.20. - [Release notes](https://github.com/dtolnay/quote/releases) - [Commits](https://github.com/dtolnay/quote/compare/1.0.19...1.0.20) --- updated-dependencies: - dependency-name: quote dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * backport minimum weight to fee to master (#5739) * propose fix fees * add tests to kusama runtime as well * better tests * last change * last update * Fix test * ignore tests again * staking-miner: CLI flag delay solution x secs (#5734) * staking-miner: CLI flag delay solution x secs * Update utils/staking-miner/src/monitor.rs * Update utils/staking-miner/src/opts.rs * more logging * add more verbose logging * Update utils/staking-miner/src/opts.rs Co-authored-by: David <dvdplm@gmail.com> * Update utils/staking-miner/src/opts.rs Co-authored-by: David <dvdplm@gmail.com> * remove redundant check Co-authored-by: David <dvdplm@gmail.com> * fix(staking miner): check latest state in solution (#5744) * bump zombienet version and fix test * Update zombienet_tests/smoke/0003-deregister-register-validator-smoke.toml Co-authored-by: Chevdor <chevdor@users.noreply.github.com> * Update zombienet_tests/smoke/0003-deregister-register-validator.js Co-authored-by: Chevdor <chevdor@users.noreply.github.com> Co-authored-by: Andrei Sandu <andrei-mihail@parity.io> Co-authored-by: Alexander Samusev <41779041+alvicsam@users.noreply.github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com> Co-authored-by: David <dvdplm@gmail.com> Co-authored-by: Andrei Sandu <54316454+sandreim@users.noreply.github.com> Co-authored-by: Chevdor <chevdor@users.noreply.github.com>
This commit is contained in:
@@ -785,6 +785,33 @@ zombienet-tests-malus-dispute-valid:
|
||||
tags:
|
||||
- zombienet-polkadot-integration-test
|
||||
|
||||
zombienet-tests-deregister-register-validator:
|
||||
stage: stage3
|
||||
image: "docker.io/paritytech/zombienet:v1.2.47"
|
||||
<<: *kubernetes-env
|
||||
<<: *zombienet-refs
|
||||
needs:
|
||||
- job: publish-polkadot-debug-image
|
||||
artifacts: true
|
||||
variables:
|
||||
GH_DIR: "https://github.com/paritytech/polkadot/tree/${CI_COMMIT_SHORT_SHA}/zombienet_tests/smoke"
|
||||
before_script:
|
||||
- echo "Zombie-net Tests Config"
|
||||
- echo "${ZOMBIENET_IMAGE_NAME}"
|
||||
- echo "${PARACHAINS_IMAGE_NAME} ${PARACHAINS_IMAGE_TAG}"
|
||||
- echo "${GH_DIR}"
|
||||
- export DEBUG=zombie*
|
||||
- export ZOMBIENET_INTEGRATION_TEST_IMAGE=${PARACHAINS_IMAGE_NAME}:${PARACHAINS_IMAGE_TAG}
|
||||
- export MALUS_IMAGE=${MALUS_IMAGE_NAME}:${MALUS_IMAGE_TAG}
|
||||
script:
|
||||
- /home/nonroot/zombie-net/scripts/ci/run-test-env-manager.sh
|
||||
--github-remote-dir="${GH_DIR}"
|
||||
--test="0003-deregister-register-validator-smoke.feature"
|
||||
allow_failure: false
|
||||
retry: 2
|
||||
tags:
|
||||
- zombienet-polkadot-integration-test
|
||||
|
||||
#### stage: stage4
|
||||
|
||||
publish-rustdoc:
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
Description: Deregister / Register Validator Smoke
|
||||
Network: ./0003-deregister-register-validator-smoke.toml
|
||||
Creds: config
|
||||
|
||||
alice: is up
|
||||
bob: is up
|
||||
charlie: is up
|
||||
dave: is up
|
||||
|
||||
# ensure is in the validator set
|
||||
dave: reports polkadot_node_is_parachain_validator is 1 within 240 secs
|
||||
dave: reports polkadot_node_is_active_validator is 1 within 240 secs
|
||||
|
||||
# deregister and check
|
||||
alice: js-script ./0003-deregister-register-validator.js with "deregister,dave" return is 0 within 30 secs
|
||||
|
||||
# Wait 2 sessions. The authority set change is enacted at curent_session + 2.
|
||||
sleep 120 seconds
|
||||
dave: reports polkadot_node_is_parachain_validator is 0 within 180 secs
|
||||
dave: reports polkadot_node_is_active_validator is 0 within 180 secs
|
||||
|
||||
# register and check
|
||||
alice: js-script ./0003-deregister-register-validator.js with "register,dave" return is 0 within 30 secs
|
||||
|
||||
# Wait 2 sessions. The authority set change is enacted at curent_session + 2.
|
||||
sleep 120 seconds
|
||||
dave: reports polkadot_node_is_parachain_validator is 1 within 180 secs
|
||||
dave: reports polkadot_node_is_active_validator is 1 within 180 secs
|
||||
@@ -0,0 +1,24 @@
|
||||
[settings]
|
||||
timeout = 1000
|
||||
|
||||
[relaychain]
|
||||
default_image = "{{ZOMBIENET_INTEGRATION_TEST_IMAGE}}"
|
||||
chain = "rococo-local"
|
||||
command = "polkadot"
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "alice"
|
||||
args = ["-lruntime=debug,parachain=trace" ]
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "bob"
|
||||
args = [ "-lruntime=debug,parachain=trace" ]
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "charlie"
|
||||
args = [ "-lruntime=debug,parachain=trace" ]
|
||||
|
||||
[[relaychain.nodes]]
|
||||
name = "dave"
|
||||
args = [ "-lruntime=debug,parachain=trace" ]
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
const assert = require("assert");
|
||||
|
||||
function nameCase(string) {
|
||||
return string.charAt(0).toUpperCase() + string.slice(1);
|
||||
}
|
||||
|
||||
async function run(nodeName, networkInfo, jsArgs) {
|
||||
const {wsUri, userDefinedTypes} = networkInfo.nodesByName[nodeName];
|
||||
const api = await zombie.connect(wsUri, userDefinedTypes);
|
||||
const action = jsArgs[0] === "register" ? "registerValidators" : "deregisterValidators"
|
||||
const validatorName = jsArgs[1]; // used as seed
|
||||
|
||||
await zombie.util.cryptoWaitReady();
|
||||
|
||||
// account to submit tx
|
||||
const keyring = new zombie.Keyring({ type: "sr25519" });
|
||||
const alice = keyring.addFromUri("//Alice");
|
||||
const validatorStash = keyring.createFromUri(`//${nameCase(validatorName)}//stash`);
|
||||
|
||||
await new Promise(async (resolve, reject) => {
|
||||
const unsub = await api.tx.sudo
|
||||
.sudo(api.tx.validatorManager[action]([validatorStash.address]))
|
||||
.signAndSend(alice, (result) => {
|
||||
console.log(`Current status is ${result.status}`);
|
||||
if (result.status.isInBlock) {
|
||||
console.log(
|
||||
`Transaction included at blockHash ${result.status.asInBlock}`
|
||||
);
|
||||
} else if (result.status.isFinalized) {
|
||||
console.log(
|
||||
`Transaction finalized at blockHash ${result.status.asFinalized}`
|
||||
);
|
||||
unsub();
|
||||
return resolve();
|
||||
} else if (result.isError) {
|
||||
console.log(`Transaction Error`);
|
||||
unsub();
|
||||
return reject();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
module.exports = { run }
|
||||
Reference in New Issue
Block a user