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

Open
0x-r4bbit opened this issue Dec 20, 2024 · 0 comments · May be fixed by #110
Open

Fix incorrect reward index update #102

0x-r4bbit opened this issue Dec 20, 2024 · 0 comments · May be fixed by #110

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

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