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

Able to chill inactive validator #7128

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

aurexav
Copy link
Contributor

@aurexav aurexav commented Jan 13, 2025

Add a new extrinsic chill_inactive_validator and a new storage config ChillInactiveValidatorThreshold:

  • Anyone can call this function.
  • The validator's stash account should be provided.
  • The proof should be a list of consecutive sorted era indexes where the validator has
    not produced any blocks.
  • This will only be successful if the validator has not produced any blocks in ChillInactiveValidatorThreshold consecutive eras.
  • If the ChillInactiveValidatorThreshold is not set, it will fallback to Config::HistoryDepth. It's almost the same as current on-chain logic. The inactive validator is almost impossible to be chilled by others, unless it missed 84 eras.

Closes #5674.


Polkadot address: 156HGo9setPcU2qhFMVWLkcmtCEGySLwNqa3DaEiYSWtte4Y

substrate/frame/staking/src/pallet/mod.rs Outdated Show resolved Hide resolved
return Ok(());
}
} else {
consecutive_inactives = 0;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
consecutive_inactives = 0;
break;

Invalid proof.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same as above.

Comment on lines +2364 to +2366
consecutive_inactives = 0;

continue;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
consecutive_inactives = 0;
continue;
break;

Invalid proof.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This also makes the rule strict. Every point needs to be valid. However, it’s acceptable if we anticipate this.

Comment on lines +2355 to +2359
// Check if the ear exists.
if !ErasRewardPoints::<T>::contains_key(era) {
consecutive_inactives = 0;

continue;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Check if the ear exists.
if !ErasRewardPoints::<T>::contains_key(era) {
consecutive_inactives = 0;
continue;
// Check if the era exists.
if !ErasRewardPoints::<T>::contains_key(era) {
break;

Invalid proof.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Validator inactive for [0, 1, 2, 3].
Threshold 3.
Era 0 gets clipped from the history at the moment.

This will reject [0, 1, 2, 3]. Is this expected?

substrate/frame/staking/src/pallet/mod.rs Show resolved Hide resolved
@bkchr bkchr added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Jan 13, 2025
@bkchr bkchr requested a review from kianenigma January 13, 2025 20:13
aurexav and others added 2 commits January 14, 2025 04:37
Co-authored-by: Bastian Köcher <[email protected]>
Co-authored-by: Bastian Köcher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Staking Elections: Consider removing validators with no points
2 participants