This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, as it seems we eject the prime when we remove a members, or typically alter the members via
set_members_sorted
. This makes sense because the call site does not really know if the new set contains the previous noted prime or not.This PR changes this behaviour so that if we know that the removed member is not the current prime, then we set it again (i.e. keep it).
In kusama, the first block after this transaction caused the prime to be ejected for example:
https://polkascan.io/kusama/transaction/0x715eae46d4ec9c458b9d835bce5a1a3bbbb67d0e501c09fafe8fbbaddb292710
Additionally, I've mistakingly changed the calculation of the prime to use u64 (
VoteWeight
). I reverted it as it was a horrible idea and it is very likely to overflow. Also made the arithmetic saturating anyhow.