Staking.deposit() There's a significant issue in how the contract updates its record of cumulative rewards, which results in users not receiving the correct amount of rewards and the remaining portion of funds stuck in the contract forever.
Staking.deposit() There's a significant issue in how the contract updates its record of cumulative rewards, which results in users not receiving the correct amount of rewards and the remaining portion of funds stuck in the contract forever.
Here's an example to illustrate the issue: Suppose the staking contract has 100 TKN deposited, and the protocol transfers 100 WETH as rewards for those staking their tokens. Until the next action that changes the state of the staking contract, the cumulative rewards and other necessary details aren't updated.
Now, let's say another user deposits 100 TKN into the contract. The deposit function takes 100 TKN from the user and updates the contract's state. However, instead of calculating the additional cumulative rewards as 100 WETH divided by the original 100 TKN (which would be correct), it calculates the additional cumulative rewards as 100 WETH divided by the new total of 200 TKN. This is because the contract fetches the current deposit amount before it updates the rewards information. As a result, the rewards are distributed over a larger number of tokens than they should be, leading to inaccurately low reward payouts.
users will not receive the correct amount of rewards and funds will get stuck in the contract forever.
manual review
Update the user’s rewards before transferring tokens from the staker.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.