DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Misleading epoch in `RewardAdded` event

Summary

addReward function emits a RewardAdded event with a potentially outdated epoch number which causes misleading event logs.

Vulnerability Details

Take a look athe the addReward function

function addReward(uint256 _amount) external onlyRewardAdmin {
//CHECK
if (_amount == 0) revert InvalidAmount();
//EFFECT
uint16 previousEpoch = currentEpoch;
//INTERACT
fjordToken.safeTransferFrom(msg.sender, address(this), _amount);
_checkEpochRollover();
emit RewardAdded(previousEpoch, msg.sender, _amount);
}

As seen above, the current epoch is stored in a variable previousEpoch before calling _checkEpochRollover(). The RewardAdded event is then emitted using this previousEpoch value. IF an epoch rollover occurs during the execution of _checkEpochRollover(), the emitted event will contain an outdated epoch number that doesn't accurately reflect when the reward was added.

Impact

Misleading event logs.

Tools Used

Manual

Recommendations

Update the addReward function to emit the RewardAdded event with the current epoch after the potential rollover. To ensure that the event always contains the accurate epoch number.

Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Design choice
Assigned finding tags:

Misleading epoch in `RewardAdded` event

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.