-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Fix wrong outgoing calculation in election #7384
Conversation
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.
Please add a test that this never happens again.
@kianenigma actually it is not exactly clear to me how sorting by AccountIds matters? Can you elaborate? |
|
added. |
bot merge |
Waiting for commit status. |
Use OrderedSet should prevent this kind of bugs |
Hmm, coming from Haskell. Can't we check this at the type level instead of just tests? E.g. encode the sorting requirement in the calling contract of |
Both points are sensible improvements. I will make a follow up issue. fwiw both Polkadot and Kusama have passed motions to refund all the immature slashing done over here. https://polkadot.polkassembly.io/motion/43 |
There is even a crate for this, which looks sane and could be useful. |
This was a very unfortunate oversight from my end; The outgoing calculation seem to have been wrong because the inputs are simply not sorted. This can then cause accounts to be immaturely deemed loser, and subject to
slash_reserved()
.This should be merged and deployed asap. Furthermore, I will lead an investigation over polkadot's state to make sure we can obtain a list of all accounts affected and properly reimburse them through governance.