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 incorrect reward index update #102

Closed
0x-r4bbit opened this issue Dec 20, 2024 · 1 comment
Closed

Fix incorrect reward index update #102

0x-r4bbit opened this issue Dec 20, 2024 · 1 comment

Comments

@0x-r4bbit
Copy link
Collaborator

After deploying some version of the staking system, we've uncovered a bug that rewards are calculated incorrectly when staking and unstaking.

The issue relies in the fact that, when the rewardsBalanceOf gets the newRewardIndex, the account.rewardIndex is possibly as big, which results a reward index delta of 0.

That in turn resets the rewards to 0 until some time passes.
We need to revisit that and ensure that we set the account.rewardIndex correctly when stake and unstake is called

@0x-r4bbit
Copy link
Collaborator Author

This has been fixed with #136

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment