-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add MinPointsToBalance to nomination pools #11377
Conversation
Is it worth making |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, benchmarks still need to be re-run 👍
frame/nomination-pools/src/lib.rs
Outdated
// while restricting the balance to 1/10th of max total issuance, | ||
let next_bonded_balance = bonded_balance.saturating_add(new_funds); | ||
ensure!( | ||
next_bonded_balance < BalanceOf::<T>::max_value().div(10u32.into()), | ||
next_bonded_balance < | ||
BalanceOf::<T>::max_value().div(MinPointsToBalance::<T>::get().into()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we prevent someone puts zero in here? Otherwise it panics.
Maybe use a checked_div
?
…ytech/substrate into rb-points-to-balance-ratio
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
This PR does not add a new storage item. Can you update the description so I can review intention vs code? |
yes. The description has been amended. |
needs companions |
companions need to be happy here. |
paritytech/polkadot#5520 Needs another review. Requested @ggwpez |
bot rebase |
Rebasing |
bot merge |
Error: "Check reviews" status is not passing for paritytech/polkadot#5520 |
bot merge |
Error: Statuses failed for f4730be |
bot rebase |
Rebasing |
cumulus CI seems to be breaking here
Dunno where |
* add MinPointsToBalance to pools * add min_points_to_balance to benchmark mock * fmt * comments Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * check min_points_to_balance.is_zero * comment * comment * storage to constant * fix * comment Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
* add MinPointsToBalance to pools * add min_points_to_balance to benchmark mock * fmt * comments Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * check min_points_to_balance.is_zero * comment * comment * storage to constant * fix * comment Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
* add MinPointsToBalance to pools * add min_points_to_balance to benchmark mock * fmt * comments Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> * check min_points_to_balance.is_zero * comment * comment * storage to constant * fix * comment Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: parity-processbot <>
This PR adds a new runtime constant item for the minimum points to balance ratio to join a nomination pool. Attempts to address #10792.
The name
MinPointsToBalance
has been used as an attempt to keep it short.fixes #11377
The previously hardcoded value of 10, where
OverFlowRisk
has been tested, has been replaced with the storage item.Tests have been amended to take the new ratio into consideration.
polkadot companion: paritytech/polkadot#5520