-
Notifications
You must be signed in to change notification settings - Fork 335
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix max nominators per collator upgrade bug #751
Merged
4meta5
merged 3 commits into
patch-staking-bond-less-deletes-bottom-nominator-bug
from
amar-patch-max-nominations-upgrade-mistake
Aug 30, 2021
Merged
Fix max nominators per collator upgrade bug #751
4meta5
merged 3 commits into
patch-staking-bond-less-deletes-bottom-nominator-bug
from
amar-patch-max-nominations-upgrade-mistake
Aug 30, 2021
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4meta5
changed the title
Patch max nominators per collator upgrade mistake
Patch max nominators per collator upgrade bug
Aug 30, 2021
4meta5
added
A3-inprogress
Pull request is in progress. No review needed at this stage.
B7-runtimenoteworthy
Changes should be noted in any runtime-upgrade release notes
labels
Aug 30, 2021
4meta5
changed the title
Patch max nominators per collator upgrade bug
Fix max nominators per collator upgrade bug
Aug 30, 2021
4meta5
added
the
C7-high
Elevates a release containing this PR to "high priority".
label
Aug 30, 2021
4meta5
commented
Aug 30, 2021
2 tasks
crystalin
pushed a commit
that referenced
this pull request
Aug 30, 2021
* in progress * update top nominators list upon changes and do not remove any bottom nominations * test fix * init migration to start to fix inconsistent state * more progress on migration * improve nomination increase decrease events * fmt * review and comment all uses of pop * add two different errors for each source of inconsistency and init migration unit test * add unreserve stakers extrinsic gated by root to unreserve the reserved non nominators * in middle of testing migration and found bug wherein nominator can have no nominations after it runs * fix migration, still needs weights * rename root unreserve function and finish migration test * last few changes to public visibility to keep the test without exposing storage write functionality to outside of crate * fix comment * Fix max nominators per collator upgrade bug (#751) * init naive not tested * fix compilation errors, still needs tests * test * fix total staked in hotfix_unreserve_nomination as well * accept review comments * fix weight returned in on runtime upgrade * remove accounts due unreserved balance storage item and use btreemap in memory instead * try fix * no filtering condition on first migration loop * merge migration functions into one function * conservative weight estimate * Update pallets/parachain-staking/src/lib.rs Co-authored-by: girazoki <gorka.irazoki@gmail.com> Co-authored-by: girazoki <gorka.irazoki@gmail.com>
crystalin
pushed a commit
that referenced
this pull request
Aug 30, 2021
* in progress * update top nominators list upon changes and do not remove any bottom nominations * test fix * init migration to start to fix inconsistent state * more progress on migration * improve nomination increase decrease events * fmt * review and comment all uses of pop * add two different errors for each source of inconsistency and init migration unit test * add unreserve stakers extrinsic gated by root to unreserve the reserved non nominators * in middle of testing migration and found bug wherein nominator can have no nominations after it runs * fix migration, still needs weights * rename root unreserve function and finish migration test * last few changes to public visibility to keep the test without exposing storage write functionality to outside of crate * fix comment * Fix max nominators per collator upgrade bug (#751) * init naive not tested * fix compilation errors, still needs tests * test * fix total staked in hotfix_unreserve_nomination as well * accept review comments * fix weight returned in on runtime upgrade * remove accounts due unreserved balance storage item and use btreemap in memory instead * try fix * no filtering condition on first migration loop * merge migration functions into one function * conservative weight estimate * Update pallets/parachain-staking/src/lib.rs Co-authored-by: girazoki <gorka.irazoki@gmail.com> Co-authored-by: girazoki <gorka.irazoki@gmail.com>
3 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A3-inprogress
Pull request is in progress. No review needed at this stage.
B7-runtimenoteworthy
Changes should be noted in any runtime-upgrade release notes
C7-high
Elevates a release containing this PR to "high priority".
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.
When we increased
MaxNominatorsPerCollator
from 10 -> 100 in #746 , we did not add a migration to push the bottom nominators into the top upon the change. The fix is a migration that fixes the top_nominators and bottom_nominators fields for all CollatorState.It is naive in its current state and could be optimized by combining it with the other runtime upgrade instead of keeping it separate. I'm writing a unit test to verify correctness now.