mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 23:21:06 +00:00
staking: avoid proportional slashing leak dust into chunks that should not be slashed (#12058)
* replace slash ratio with remaining ratio Signed-off-by: linning <linningde25@gmail.com> * little refactor Signed-off-by: linning <linningde25@gmail.com> * fix test Signed-off-by: linning <linningde25@gmail.com> * fix typo Signed-off-by: linning <linningde25@gmail.com> * revert refactor Signed-off-by: linning <linningde25@gmail.com> * rounding up instead of remaining ratio Signed-off-by: linning <linningde25@gmail.com> * address comment Signed-off-by: linning <linningde25@gmail.com> * Update frame/nomination-pools/test-staking/src/lib.rs Signed-off-by: linning <linningde25@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> * Update frame/nomination-pools/test-staking/src/lib.rs Signed-off-by: linning <linningde25@gmail.com> Co-authored-by: Roman Useinov <roman.useinov@gmail.com> Signed-off-by: linning <linningde25@gmail.com> Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com> Co-authored-by: Roman Useinov <roman.useinov@gmail.com> Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -490,12 +490,10 @@ fn pool_slash_proportional() {
|
||||
assert_eq!(
|
||||
pool_events_since_last_call(),
|
||||
vec![
|
||||
// This last pool got slashed only the leftover dust. Otherwise in principle, this
|
||||
// chunk/pool should have not been affected.
|
||||
PoolsEvent::UnbondingPoolSlashed { pool_id: 1, era: 127, balance: 19 },
|
||||
// This pool got slashed 12.5, which rounded down to 12.
|
||||
PoolsEvent::UnbondingPoolSlashed { pool_id: 1, era: 128, balance: 8 },
|
||||
// This pool got slashed 12.5, which rounded down to 12.
|
||||
// This era got slashed 12.5, which rounded up to 13.
|
||||
PoolsEvent::UnbondingPoolSlashed { pool_id: 1, era: 128, balance: 7 },
|
||||
// This era got slashed 12 instead of 12.5 because an earlier chunk got 0.5 more
|
||||
// slashed, and 12 is all the remaining slash
|
||||
PoolsEvent::UnbondingPoolSlashed { pool_id: 1, era: 129, balance: 8 },
|
||||
// Bonded pool got slashed for 25, remaining 15 in it.
|
||||
PoolsEvent::PoolSlashed { pool_id: 1, balance: 15 }
|
||||
|
||||
Reference in New Issue
Block a user