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

Staking: Max nominators for each operator #2120

Merged
merged 2 commits into from
Oct 16, 2023
Merged

Staking: Max nominators for each operator #2120

merged 2 commits into from
Oct 16, 2023

Conversation

vedhavyas
Copy link
Member

This PR introduces MaxNominators parameter to limit nominators per Operators.
Since we cannot use CountedStorageNmap to get the count with operatorId prefix, I introduced a new storage that tracks the nominator count for each operator. The count is tracked when there is a new nominator show intent to nominate or when a Nominator withdraws all the stake from an Operator.

If MaxNominators are set to 0, which is a requirement for Stake wars, this will not allow any nominators for any operators and can be changed through a runtime upgrade.

cc: @jfrank-summit

Code contributor checklist:

Copy link
Member

@NingLin-P NingLin-P left a comment

Choose a reason for hiding this comment

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

Just one question

Comment on lines +291 to +293
/// The maximum number of nominators for given operator.
#[pallet::constant]
type MaxNominators: Get<u32>;
Copy link
Member

Choose a reason for hiding this comment

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

The limit is applied to every operator in every domain, perhaps we should move it to the OperatorConfig (similar to minimum_nominator_stake) such that:

  • The limit is applied to a single operator and specified by the operator itself
  • The limit can be updated through an extrinsic instead of a consensus runtime upgrade

Copy link
Member Author

Choose a reason for hiding this comment

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

As discussed during the call, this is not what we are aiming to solve for stakewars and this approach would solve the operator deregistration issue with a lot of nominators

@vedhavyas vedhavyas requested a review from NingLin-P October 16, 2023 15:49
@vedhavyas vedhavyas added this pull request to the merge queue Oct 16, 2023
Merged via the queue into main with commit e182503 Oct 16, 2023
10 checks passed
@vedhavyas vedhavyas deleted the max_nominators branch October 16, 2023 19:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants