[Fix|NominationPools] Only allow apply slash to be executed if the slash...
[Fix|NominationPools] Only allow apply slash to be executed if the slash amount is atleast ED (#6540)
This change prevents `pools::apply_slash` from being executed when the
pending slash amount of the member is lower than the ED.
The issue came to light with the failing [benchmark
test](https://github.com/polkadot-fellows/runtimes/actions/runs/11879471717/job/33101445269?pr=490#step:11:765)
in Kusama. The problem arises from the inexact conversion between points
and balance. Specifically, when points are converted to balance and then
back to points, rounding can introduce a small discrepancy between the
input and the resulting value. This issue surfaced in Kusama due to its
ED being different from Westend and Polkadot (1 UNIT/300), making the
rounding issue noticeable.
This fix is also significant because applying a slash is feeless and
permissionless. Allowing super small slash amounts to be applied without
a fee is undesirable. With this change, such small slashes will still be
applied but only when member funds are withdrawn.
---------
Co-authored-by:
Dónal Murray <donal.murray@parity.io>
Showing
- prdoc/pr_6540.prdoc 16 additions, 0 deletionsprdoc/pr_6540.prdoc
- substrate/frame/nomination-pools/runtime-api/src/lib.rs 3 additions, 0 deletionssubstrate/frame/nomination-pools/runtime-api/src/lib.rs
- substrate/frame/nomination-pools/src/lib.rs 18 additions, 5 deletionssubstrate/frame/nomination-pools/src/lib.rs
- substrate/frame/nomination-pools/test-delegate-stake/Cargo.toml 1 addition, 1 deletion...ate/frame/nomination-pools/test-delegate-stake/Cargo.toml
- substrate/frame/nomination-pools/test-delegate-stake/src/lib.rs 33 additions, 4 deletions...ate/frame/nomination-pools/test-delegate-stake/src/lib.rs