Closes https://github.com/paritytech/polkadot-sdk/issues/1966, https://github.com/paritytech/polkadot-sdk/issues/1963 and https://github.com/paritytech/polkadot-sdk/issues/1962. Disabling strategy specification [here](https://github.com/paritytech/polkadot-sdk/pull/2955). (Updated 13/02/2024) Implements: * validator disabling for a whole era instead of just a session * no more than 1/3 of the validators in the active set are disabled Removes: * `DisableStrategy` enum - now each validator committing an offence is disabled. * New era is not forced if too many validators are disabled. Before this PR not all offenders were disabled. A decision was made based on [`enum DisableStrategy`](https://github.com/paritytech/polkadot-sdk/blob/bbb6631641f9adba30c0ee6f4d11023a424dd362/substrate/primitives/staking/src/offence.rs#L54). Some offenders were disabled for a whole era, some just for a session, some were not disabled at all. This PR changes the disabling behaviour. Now a validator committing an offense is disabled immediately till the end of the current era. Some implementation notes: * `OffendingValidators` in pallet session keeps all offenders (this is not changed). However its type is changed from `Vec<(u32, bool)>` to `Vec<u32>`. The reason is simple - each offender is getting disabled so the bool doesn't make sense anymore. * When a validator is disabled it is first added to `OffendingValidators` and then to `DisabledValidators`. This is done in [`add_offending_validator`](https://github.com/paritytech/polkadot-sdk/blob/bbb6631641f9adba30c0ee6f4d11023a424dd362/substrate/frame/staking/src/slashing.rs#L325) from staking pallet. * In [`rotate_session`](https://github.com/paritytech/polkadot-sdk/blob/bdbe98297032e21a553bf191c530690b1d591405/substrate/frame/session/src/lib.rs#L623) the `end_session` also calls [`end_era`](https://github.com/paritytech/polkadot-sdk/blob/bbb6631641f9adba30c0ee6f4d11023a424dd362/substrate/frame/staking/src/pallet/impls.rs#L490) when an era ends. In this case `OffendingValidators` are cleared **(1)**. * Then in [`rotate_session`](https://github.com/paritytech/polkadot-sdk/blob/bdbe98297032e21a553bf191c530690b1d591405/substrate/frame/session/src/lib.rs#L623) `DisabledValidators` are cleared **(2)** * And finally (still in `rotate_session`) a call to [`start_session`](https://github.com/paritytech/polkadot-sdk/blob/bbb6631641f9adba30c0ee6f4d11023a424dd362/substrate/frame/staking/src/pallet/impls.rs#L430) repopulates the disabled validators **(3)**. * The reason for this complication is that session pallet knows nothing abut eras. To overcome this on each new session the disabled list is repopulated (points 2 and 3). Staking pallet knows when a new era starts so with point 1 it ensures that the offenders list is cleared. --------- Co-authored-by: ordian <noreply@reusable.software> Co-authored-by: ordian <write@reusable.software> Co-authored-by: Maciej <maciej.zyszkiewicz@parity.io> Co-authored-by: Gonçalo Pestana <g6pestana@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: command-bot <> Co-authored-by: Ankan <10196091+Ank4n@users.noreply.github.com>
Zombienet tests
The content of this directory is meant to be used by Parity's private CI/CD infrastructure with private tools. At the moment those tools are still early stage of development and we don't know if / when they will available for public use.
Contents of this directory
parachains At the moment this directory only have one test related to parachains: /parachains-smoke-test, that check
the parachain registration and the block height.
Resources
Running tests locally
To run any test locally use the native provider (zombienet test -p native ...) you need first build the binaries. They
are:
adder-collator->polkadot/target/testnet/adder-collatormalus->polkadot/target/testnet/maluspolkadot->polkadot/target/testnet/polkadot,polkadot/target/testnet/polkadot-prepare-worker,polkadot/target/testnet/polkadot-execute-workerpolkadot-collator->cumulus/target/release/polkadot-parachainundying-collator->polkadot/target/testnet/undying-collator
To build them use:
adder-collator->cargo build --profile testnet -p test-parachain-adder-collatorundying-collator->cargo build --profile testnet -p test-parachain-undying-collatormalus->cargo build --profile testnet -p polkadot-test-maluspolkadot(in the Polkadot repo) andpolkadot-collator(in Cumulus repo) ->cargo build --profile testnet
One solution is to use the .set_env file (from this directory) and fill the CUSTOM_PATHS before source it to patch
the PATH of your system to find the binaries you just built.
E.g.:
$ cat .set_env
(...)
# by the order of this array
CUSTOM_PATHS=(
"~/polkadot/target/release"
"~/polkadot/target/testnet"
"~/cumulus/target/release"
)
(...)
source .set_env
Then you have your PATH customized and ready to run zombienet. NOTE: You should need to do this ones per
terminal session, since we are patching the PATH and re-exporting. Or you can also source this file in your
.bashrc file to get executed automatically in each new session.
Example:
You can run a test locally by executing:
zombienet test -p native 0001-parachains-pvf.zndsl
Questions / permissions
Ping in element Javier (@javier:matrix.parity.io) to ask questions or grant permission to run the test from your local
setup.