This repository has been archived by the owner on Nov 3, 2024. It is now read-only.
0x73696d616f - rewardData.releaseRate
is incorrectly calculated on RewardsController::config()
when block.timestamp > start
and rewardData.lastConfig != rewardData.start
#245
Labels
Has Duplicates
A valid issue with 1+ other issues describing the same vulnerability
Medium
A valid Medium severity issue
Reward
A payout will be made for this issue
Sponsor Confirmed
The sponsor acknowledged this issue is valid
Will Fix
The sponsor confirmed this issue will be fixed
0x73696d616f
high
rewardData.releaseRate
is incorrectly calculated onRewardsController::config()
whenblock.timestamp > start
andrewardData.lastConfig != rewardData.start
Summary
Setting new parameters in
RewardsController::config()
will lead to lost rewards ifblock.timestamp > start
and therewardData.start
was set in the future initially.Vulnerability Detail
When
RewardsController::config()
is called to update the data of a reward, as it was already set initially, it will go into theelse
branch. In here, it updates therewardRate
according to the previously distributed rewards, the total distribution and the distribution periods. More precisely, the calculation is:It calculates the release pro-rata to
block.timestamp - rewardData.lastConfig
, considering the time that the rewards have been emitted, but this is incorrect whenrewardData.start
was set in the future when creating the initial config. This will lead to the overestimation of released rewards, which will lower therewardData.releaseRate
, as it is pro-rata toconfigs[i].totalDistribution - released
. Thus, less rewards will be distributed than expected.Impact
Lost of rewards for users that will receive less than supposed.
Code Snippet
https://github.com/sherlock-audit/2024-04-interest-rate-model/blob/main/protocol/contracts/RewardsController.sol#L681
https://github.com/sherlock-audit/2024-04-interest-rate-model/blob/main/protocol/contracts/RewardsController.sol#L699
Tool used
Manual Review
Vscode
Recommendation
The release rewards are
rewardData.releaseRate * (block.timestamp - rewardData.start);
.The text was updated successfully, but these errors were encountered: