Updating deposits would fail for some strategies causing core functionalities accross scope to be unreachable.
Take a look at https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/linkStaking/OperatorVCS.sol#L159-L223
This function is used to update deposit accounting and calculate fees on newly earned rewards to all beneficiaries. The issue, however, is that there is an edge case where the function reverts without any deposits being updated.
Note that there is a valid instance where we would expect our deposit change to be negative, which is why this block exists:
https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/linkStaking/OperatorVCS.sol#L212-L215
In that case, the change is deducted from the new deposits. The issue, however, is that the protocol assumes the value of depositChange
in uint is always going to be less than newTotalDeposits
. However, this is not enforced, which then causes the attempt at updating the deposits to revert when uint256(depositChange) > newTotalDeposits
.
Core functionality is broken, considering the functionality is used heavily across scope. In one case, we have it being used to attempt to distribute rewards/fees based on balance changes in strategies since the last update in the staking pool: https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/core/StakingPool.sol#L529-L548
It is key to note that this functionality is used when attempting to remove strategies and also when the rebase controller or the strategy itself is trying to update the rewards: https://github.com/Cyfrin/2024-09-stakelink/blob/f5824f9ad67058b24a2c08494e51ddd7efdbb90b/contracts/core/StakingPool.sol#L413-L417.
This report shows how in all these instances, the attempt could revert and essentially mean that a strategy cannot get removed/deprecated (which should always be available).
Even worse, the rebase controller can't function properly as:
Upkeeps can't be performed in the case of a negative rebase or pauses the priority pool if losses exceed the maximum since the attempt would revert here.
Attempts to update the rewards by the rebase bot would also always fail here.
Even if the owner decides to reopen the pool due to them maybe being paused on the basis of a significant slashing event and rebases the staking pool, it also would always revert here for the strategy.
NB: All the functionalities listed above in this section should be available, however, as shown, that isn't the case and as such core functionalities would be broken
Manual review
Here is the report with the typos fixed:
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.