This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
[Zombienet] test deregister validator #5718
Merged
paritytech-processbot
merged 18 commits into
master
from
zombienet-test-deregister-validator
Jul 5, 2022
Merged
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
ef42031
Update metric name and doc
sandreim 3ae9a38
add test and rename metric to use
pepoviola 90f0729
change within time for test
pepoviola ea484ca
Merge branch 'sandreim/fix_metric_confusion' into zombienet-test-dere…
pepoviola 0eac156
Update .gitlab-ci.yml
pepoviola 2601276
Update .gitlab-ci.yml
pepoviola fee7b96
Properly format the stash account
sandreim 6f870b4
Update test
sandreim 0af72dc
change metric name
pepoviola 257be74
Merge branch 'master' of github.com:paritytech/polkadot into zombiene…
sandreim 6fbc92d
Bump quote from 1.0.19 to 1.0.20 (#5736)
dependabot[bot] 979ba30
backport minimum weight to fee to master (#5739)
kianenigma 83baccb
staking-miner: CLI flag delay solution x secs (#5734)
niklasad1 d5526ae
fix(staking miner): check latest state in solution (#5744)
niklasad1 b42e9b5
bump zombienet version and fix test
pepoviola 7caa11e
Merge branch 'master' into zombienet-test-deregister-validator
pepoviola 3531fa4
Update zombienet_tests/smoke/0003-deregister-register-validator-smoke…
sandreim 94da821
Update zombienet_tests/smoke/0003-deregister-register-validator.js
sandreim File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
zombienet_tests/smoke/0003-deregister-register-validator-smoke.feature
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
pepoviola marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| 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 | ||
pepoviola marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # 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 | ||
24 changes: 24 additions & 0 deletions
24
zombienet_tests/smoke/0003-deregister-register-validator-smoke.toml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" ] | ||
|
|
46 changes: 46 additions & 0 deletions
46
zombienet_tests/smoke/0003-deregister-register-validator.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.