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

changed slashed token calculation #20

Merged
merged 1 commit into from
Jul 14, 2023

Conversation

sampocs
Copy link
Collaborator

@sampocs sampocs commented Jul 14, 2023

Previously when a slash occurred, the percentage of liquid shares to total shares was used to determine how many tokens to decrement from the global total

deduction = slashAmount * (liquid shares / delegator shares)

However, imprecision can cause this value to deviate slightly from what's expected. Instead, the number of new liquid tokens should be calculated and then the delta should be applied. This way the total liquid staked tokens remains at parity with the value you would get by re-calculating it.

deduction = (old liquid tokens - new liquid tokens)
where liquid tokens is determined by using TokensFromShares

Copy link
Collaborator

@riley-stride riley-stride left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sampocs sampocs merged commit ce3788c into v0.45.16-ics-lsm Jul 14, 2023
21 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants