Skip to content
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 #487: remove dust in stake & share calc #515

Merged
merged 7 commits into from
Oct 5, 2021
Merged

Fix #487: remove dust in stake & share calc #515

merged 7 commits into from
Oct 5, 2021

Conversation

h4x3rotab
Copy link
Contributor

@h4x3rotab h4x3rotab commented Oct 4, 2021

Fixes #487

  • Handle dust when calculating stake & shares in the following rules:
    • Dust in user's locked stake will be removed by slash
    • Dust in a user's share is removed, and always maintain the invariant: sum(user shares) == pool's total share
    • Dust in a pool's total_stake is removed
    • Dust in withdraw queue is removed
    • Dust in payout report from GK is dismissed
  • Add a migration to remove all the existing dust in the storage
    • Analyzed with try_runtime, and with state dumped for offline analysis

Tested

Unit test with grcov:

image

@h4x3rotab h4x3rotab requested review from jasl and tolak October 5, 2021 08:56
@tolak
Copy link
Contributor

tolak commented Oct 5, 2021

Except the function name is_positive_balance , others LGTM

@h4x3rotab h4x3rotab merged commit d20ef35 into master Oct 5, 2021
@h4x3rotab h4x3rotab deleted the fix-487 branch October 5, 2021 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Khala Network collators stuck at some extrinsics
2 participants