Take a look at https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/linkStaking/OperatorVault.sol#L180-L209
This function is used to update the deposit and reward accounting for this vault. The issue, however, is that it does this by directly casting the value of trackedTotalDeposits
from uint to int, without checking if it overflows, which would then affect the rewards. Considering this block would not be executed, causing unclaimed rewards to deviate from the real value and, in this case, even be less than expected.
Loss of rewards
Manual review
Do not blindly cast from uint256 to int256.
0
would fail for some tokensIn multiple instances, we approve to 0
; however, this would fail for a lot of tokens.
For example, take a look at https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/core/StakingPool.sol#L320
The above is an instance where we have an approval of 0
in the staking pool, which would fail for a number of tokens.
NB: This is quite rampant in the code.
Approving to 0
can cause transactions to fail for certain tokens, leading to potential disruptions in the contract's functionality.
Manual review
Approve to 1
instead.
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.