DittoETH

Ditto
DeFiFoundryOracle
55,000 USDC
View results
Submission Details
Severity: high
Invalid

Critical constant error YIELD_DELAY_HOURS

Summary

A constant for 1 hours has the 'hours' committed making it 1 instead

Vulnerability Details

Constants.sol line 16

uint256 internal constant YIELD_DELAY_HOURS = 1; // omits hours

Impact

Constant is used in LibShortRecord.sol

bool isNotRecentlyModified =
LibOrders.getOffsetTimeHours() - updatedAt > Constants.YIELD_DELAY_HOURS;
if (isNotRecentlyModified) {
s.vaultUser[vault][shorter].ethEscrowed += yield;
} else {
s.vaultUser[vault][address(this)].ethEscrowed += yield;
}

The above determines if not recently modified in hours but Constants.YIELD_DELAY_HOURS = 1 the smallest unit time so LibOrders.getOffsetTimeHours() - updatedAt will likely incorrectly always be greater than 1 leading to isNotRecentlyModifed passing more than expected, leading to part below yield always being updated

s.vaultUser[vault][shorter].ethEscrowed += yield;

Therefore it results in yield being updated more times than is correct

Tools Used

Manual Analysis

Recommendations

Change to hours

uint256 internal constant YIELD_DELAY_HOURS = 1 hours; // add ommitted 'hours'
Updates

Lead Judging Commences

0xnevi Lead Judge
almost 2 years ago
0xnevi Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Other

Support

FAQs

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