DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: medium
Valid

Division before multiplication results in lower `dittoMatchedShares` distributed to users

Summary

Shares amount is rounded down to number of days staked. Max truncation is 1 day, min time is 14 days. At most 1 / 14 * 100% = 7.1% of accrued shares will be truncated.

Vulnerability Details

Division before multiplication

uint88 shares = eth * (timeTillMatch / 1 days);

Suppose timeTillMatch = 14.99 days, eth = 1e18. Expected result is 14.99 * 1e18 / 1 = 14.99e18 shares. Actual result is 1e18 * (14.99 / 1) = 14e18 shares

Impact

Up to 7.1% of user's shares will be truncated

Tools Used

Manual Review

Recommendations

- uint88 shares = eth * (timeTillMatch / 1 days);
+ uint88 shares = uint88(uint256(eth * timeTillMatch) / 1 days);
Updates

Lead Judging Commences

0xnevi Lead Judge
over 1 year ago
0xnevi Lead Judge over 1 year ago
Submission Judgement Published
Validated
Assigned finding tags:

finding-139

Support

FAQs

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