Steadefi

Steadefi
DeFiHardhatFoundryOracle
35,000 USDC
View results
Submission Details
Severity: low
Invalid

Wrong checks in addTokenMaxDelay and addTokenMaxDeviation could lead to DoS

Summary

Inside ChainlinkARBOracle are two functions called addTokenMaxDelay and addTokenMaxDeviation which can be used by the owner of contract to update parameters of chainlink feeds. These functions check if the given uint value is smaller than zero instead of checking if it is zero. This is a waste of gas as an uint value can not be below zero and the actual check if the given value is equal to zero is missing, as a zero value of these parameters would lead to a DoS of the oracle.

Vulnerability Details

Here are the mentioned checks:

function addTokenMaxDelay(address token, uint256 maxDelay) external onlyOwner {
...
if (maxDelay < 0) revert Errors.TokenPriceFeedMaxDelayMustBeGreaterOrEqualToZero();
maxDelays[token] = maxDelay;
}
function addTokenMaxDeviation(address token, uint256 maxDeviation) external onlyOwner {
...
if (maxDeviation < 0) revert Errors.TokenPriceFeedMaxDeviationMustBeGreaterOrEqualToZero();
maxDeviations[token] = maxDeviation;
}

MaxDeviation is here to check the maximum deviation between the previous price and the current price, therefore a DoS would happen on any price changes if maxDeviation equals zero.

MaxDelay is here to check the maximum delay of the chainlink oracle response time, therefore a DoS would happen if this variable is zero.

Impact

Wrong checks still allow zero maxDeviation and zero maxDelay. Which will lead to a DoS of the oracle if accidentally set and also waste gas as they check something that can not happen in solidity.

Tools Used

Manual Review

Recommendations

Change it to == 0.

Updates

Lead Judging Commences

hans Lead Judge almost 2 years ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity
Assigned finding tags:

INFO: Unnecessary maxDelay/maxDeviation check

Redundant check on maxDelay and/or maxDeviation in ARBOracle

Support

FAQs

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