checkUpkeep() function returns true when newRewards is less than 0.
The checkUpkeep function in LSTRewardSplitter incorrectly returns true when the calculated rewards are negative.
The function returns true when newRewards < 0, which is incorrect.
In performUpkeep:
When newRewards is negative, the contract actually increases principalDeposits. This is because:
-1 * newRewards converts the negative value to positive.
This positive value is cast to uint256.
principalDeposits is decreased by this positive value, which is mathematically equivalent to increasing it.
If this situation occurs multiple times, it could lead to a significant overstatement of the principal amount.
When there's a loss (i.e., the current balance is less than the recorded principal), the contract incorrectly inflates the principal instead of acknowledging the loss.
Future reward calculations based on this inflated principal will be incorrect, potentially leading to under-distribution of actual rewards.
Manual review
The performUpkeep function should be modified to correctly handle negative reward scenarios and not modify principalDeposits to a number gotten from the thin air.
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.