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

PoS round up slash rate mult with slashable amount #1830

Closed
Tracked by #2006
tzemanovic opened this issue Aug 17, 2023 · 2 comments · Fixed by #1612
Closed
Tracked by #2006

PoS round up slash rate mult with slashable amount #1830

tzemanovic opened this issue Aug 17, 2023 · 2 comments · Fixed by #1612

Comments

@tzemanovic
Copy link
Member

In PoS when processing slashes we avoid iterating over individual bonds and instead slash total validator stakes. Bonds only get slashes applied when withdrawing, so the decimal precision loss can cause the sum of individual slashes to be lower or greater than the total slashed amount.

E.g. Validator A has bond from delegators X and Y, 1 (micro) token each. If both are slashed at 30% the total slash is rounded to 2*0.3=1. When slashing individual bonds on withdrawal they're both unslashed (1*0.3=0).

Similarly with slash rate at e.g. 60%, the total slashed would be 2*0.6=1 but individual 1*0.6=1 with sum 2.

I still need to check this exactly against the code.

@brentstone
Copy link
Collaborator

I believe our rounding is always a truncation, so in Namada, 2*0.3=0 and 1*0.6=0.

@tzemanovic
Copy link
Member Author

As discussed we'll want to use ceiling mult for slashed amount calculation. With that, the slashed amount on sum of the validator stake can only be lower or equal to the sum slashes on withdrawal. This means that there might be some tokens left in validator's stake that cannot be withdrawn by anyone but themselves still contribute to validator's stake and can still be slashed which should be fine.

@tzemanovic tzemanovic mentioned this issue Aug 30, 2023
6 tasks
@tzemanovic tzemanovic changed the title PoS slashing and decimal precision PoS round up slash rate mult with slashable amount Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants