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

Edge Case for distributePoints()

Summary

https://github.com/Cyfrin/2024-08-fjord/blob/main/src/FjordPoints.sol

The distributePoints() function may not handle timing accurately if called after multiple epochs have passed, potentially resulting in incorrect calculations.

Vulnerability Details

The function increments lastDistribution based on weeksPending, which might not align perfectly with real-time elapsed, leading to inaccurate point calculations if there is a significant delay between function calls.

Impact

Inaccurate timing updates can lead to incorrect pointsPerToken calculations and unfair distribution.

Proof of Concept (PoC):

function testEdgeCase() external {
// Simulate multiple epoch passes and observe distribution issues
uint256 delay = 10 weeks;
vm.warp(block.timestamp + delay);
fjordPoints.distributePoints();
}

Tools Used

Manual Review

Recommendations

Directly set lastDistribution to block.timestamp for accurate timing:

lastDistribution = block.timestamp;
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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