ChefIncentivesController caches endRewardTime, which is not required, and may cause issues during reward update. #75
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
M-36
primary issue
Highest quality submission among a set of duplicates
🤖_primary
AI based primary recommendation
🤖_69_group
AI based duplicate group recommendation
satisfactory
satisfies C4 submission criteria; eligible for awards
selected for report
This submission will be included/highlighted in the audit report
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-07-loopfi/blob/main/src/reward/ChefIncentivesController.sol#L874
Vulnerability details
Impact
ChefIncentivesController caches endRewardTime, which is not required, and may cause issues during reward update.
Bug Description
When calculating the endRewardTime, there is a cache mechanism that caches the result for
endingTime.updateCadence
(in UT it is set to 2 days). However, during this period, if anything changes, the endRewardTime would be incorrect. For example:If the cached endRewardTime is smaller than expected, this will cause the rewards to be not distributed for the time period.
If the cached endRewardTime is larger than expected, the some pools may receive rewards after when they should, causing less rewards for other pools.
Proof of Concept
Presented above.
Tools Used
Manual Review
Recommended Mitigation Steps
Always recalculate for
endRewardTime()
and remove the cache. This is acceptable, because the_updatePool()
function is only called upon user interactions, and not called regularly, so it is not requried to save gas here.Assessed type
Other
The text was updated successfully, but these errors were encountered: