Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Nomination pools: disallow setting above global max commission #14496

Merged
merged 4 commits into from
Jul 3, 2023

Conversation

rossbulat
Copy link

@rossbulat rossbulat commented Jul 3, 2023

This PR forces pools to not have a commission configured above GlobalMaxCommission. The current code allows users to set a current commission and max commission above GlobalMaxCommission, without any error or warning when doing so.

This PR explicitly fails the set_commission_current and set_max_commission calls if the provided commission is more than GlobalMaxCommission.

  • Add a check in try_update_current to not be above GlobalMaxCommission.
  • Add a check in try_update_max to not be above GlobalMaxCommission.
  • Amend global_max_caps_max_commission_payout test to account for try_update_current check.
  • Amend set_commission_max_works_with_error_tests for try_update_max check.

@rossbulat rossbulat added A3-in_progress Pull request is in progress. No review needed at this stage. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit T1-runtime This PR/Issue is related to the topic “runtime”. labels Jul 3, 2023
@rossbulat rossbulat marked this pull request as ready for review July 3, 2023 13:40
@rossbulat rossbulat requested review from a team July 3, 2023 13:40
@rossbulat rossbulat changed the title [WIP] Force nomination pool global max commission Nomination pools: disallow setting above global max commission Jul 3, 2023
@rossbulat
Copy link
Author

bot merge

@paritytech-processbot paritytech-processbot bot merged commit 8d02095 into master Jul 3, 2023
@paritytech-processbot paritytech-processbot bot deleted the rb-force-global-max-commission branch July 3, 2023 21:22
@rossbulat rossbulat added A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). and removed A3-in_progress Pull request is in progress. No review needed at this stage. labels Jul 4, 2023
nathanwhit pushed a commit to nathanwhit/substrate that referenced this pull request Jul 19, 2023
…ytech#14496)

* add CommissionExceedsGlobalMaximum

* rename test

* amend set_commission_max_works_with_error_tests

* fmt
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A2-insubstantial Pull request requires no code review (e.g., a sub-repository hash update). B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D3-trivial 🧸 PR contains trivial changes in a runtime directory that do not require an audit T1-runtime This PR/Issue is related to the topic “runtime”.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants