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: delete account after unstake should not cause node to crash #2688

Merged
merged 2 commits into from
May 20, 2020

Conversation

bowenwang1996
Copy link
Collaborator

@bowenwang1996 bowenwang1996 commented May 20, 2020

As described in #2687, there is a critical vulnerability caused by a situation where accounts are deleted after they unstake but we still try to return 0 stake to the account. This PR submits an easy fix to the issue by not requiring account to exist when the returned stake is no more than 0. Please note that this is not the optimal way to fix it. The better way would be to change epoch manager behavior so that it will only record accounts in stake_change if it is needed. In the case of unstaking, it means that a stake change should only be recorded if it is a change from nonzero (validator or fishermen) to zero. However, this PR is enough to quickly patch the issue so that we can spend more time ironing out the proper and better fix. Resolves #2687.

@gitpod-io
Copy link

gitpod-io bot commented May 20, 2020

Copy link
Collaborator

@evgenykuzyakov evgenykuzyakov left a comment

Choose a reason for hiding this comment

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

@bowenwang1996 Please add a follow up issue, to fix it in the epoch manager.

@bowenwang1996 bowenwang1996 merged commit f46cfc0 into master May 20, 2020
@bowenwang1996 bowenwang1996 deleted the fix-delete-account-after-unstake branch May 20, 2020 03:40
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.

Stake return can cause node to crash if the account is deleted
2 participants