Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementation of validator disabling strategy in the runtime #2172

Closed
wants to merge 5 commits into from

Conversation

tdimitrov
Copy link
Contributor

This PR is a recreation of #1214 which after the transfer includes some rogue commits. Fixing it is too much hassle (there are additional merges after that) so I'm recreating it.

The strategy is described in #784 (comment). This PR outlines an initial implementation with todos.
Related to #784
Link to the PR in the old substrate repo: paritytech/substrate#14697

Things that needs to be addressed:

  • Fix the TODOs in the code.
  • Add tests
  • Add runtime migration for staking palet
  • Add benchamarks

@tdimitrov tdimitrov changed the base branch from master to tsv-disabling November 6, 2023 11:54
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: cargo-clippy
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/4224719

Ok(pos) => {
// Keep the biggest offence
if slash_proportion > offending[pos].1 {
offending[pos].1 = slash_proportion;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


let offending_threshold =
T::OffendingValidatorsThreshold::get() * validators.len() as u32;

if offending.len() >= offending_threshold as usize {
// force a new era, to select a new validator set
// force a new era, to select a new validator set. The era will be forced on the
// next session
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let mut rng = rand_chacha::ChaChaRng::from_seed(entropy.into());

let mut indecies_to_remove = BTreeSet::new();
for _ in 0..=desired_len.saturating_sub(validators.len()) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}

let disabled = if disabled.len() > LIMIT {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove_random_validators::<T>(disabled, LIMIT)
} else {
disabled
};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tdimitrov tdimitrov added the T8-polkadot This PR/Issue is related to/affects the Polkadot network. label Nov 6, 2023
@tdimitrov tdimitrov closed this Nov 8, 2023
@tdimitrov tdimitrov deleted the tsv-disabling-strategy branch November 8, 2023 07:10
bkontur pushed a commit that referenced this pull request May 10, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 14, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 15, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 15, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 15, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 16, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 17, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 17, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 17, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 20, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
bkontur pushed a commit that referenced this pull request May 21, 2024
* backport cumulus changes to bridges-master

* bump substrate, polkadot & cumulus

* backport cumulus changes

* make it build

* fix runtimes: only numeric literals are supported by sp_version::runtime_version macro

---------

Signed-off-by: acatangiu <adrian@parity.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T8-polkadot This PR/Issue is related to/affects the Polkadot network.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants