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
[Staking] Patch delegations total mismatch #1291
Conversation
T::Currency::unreserve(&delegator, amount); | ||
if state.is_active() && total_changed { |
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.
Same comment here as before, what happens if its bottom?
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.
if its just bottom then total_changed == false
so it would never enter this if branch
…g why we have conditional candidate pool update
Unrelated, but can you comment the xcm migrations that have been applied in 1200 too? I think this PR might be a good opportunity to do so |
@4meta5 did you check with try-runtime? |
I recall @notlesh said try-runtime was broken |
It compiles with the |
The purpose of try-runtime is to be able to download a storage of a live chain for testing on real data. To test the migration you can use the following command:
Thus, try-runtime will download only the storage entries for the listed pallets instances. |
I think for what @librelois wants to do you need to have a node synched (right @notlesh ?). If so, what you can is get the state of the corrupted storage in one of the chains for an account (with the RPC getStorage, by inserting the key of the corrupted storage). Then you can launch locally a network, and use sudo.setStorage, same key as before, and you will have your corrupted storage there, and you can pass your migration to your local network |
No, with try-runtime you don't need any node synced |
I ran it on moonbase and try-runtime executed without error, logs look like it worked and did fix a few candidate total_counted |
@4meta5 can you get the PoV size also with try-runtime ? |
@crystalin for moonbase, it is included in the bottom of the output https://gist.github.com/4meta5/7ef1357d2ceca43476566284ea362856
for moonriver/moonbeam, try-runtime does not yet work (MOON-1200 is the ticket to update it) |
What does it do?
MOON-1517
Summary of Bug
The totalTopDelegations value was not updated after delegator_bond_more which means that total_counted = collator_bond + totalTopDelegations was not correctly updated and total_counted is used to determine which candidates are chosen in the active set.
Consequences
This bug does not enable abuse AFAICT. It does mean some data is incorrect, but the runtime migration fixes it.
It will understate the total_counted for collators that have delegations which were increased via
delegator_bond_more
. Moreover, it will overestimate each delegation share when paying out rewards leading to increased inflation rewards. Likewise, the patch needs to be applied ASAP to minimize the impact on reward payouts.