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

`ChainlinkUtil.sol::getPrice()` should not revert when answer is minAnswer or maxAnswer

Summary

minAnswer and maxAnswer are the minimum and maximum price that can be returned by the oracle. If the answer is either of these two values then the function should not revert because when we say min/max we mean the lowest/higest price that can be returned by the oracle and are accpetable.

Vulnerability Details

Github:- https://github.com/Cyfrin/2024-07-zaros/blob/d687fe96bb7ace8652778797052a38763fbcbb1b/src/external/chainlink/ChainlinkUtil.sol#L68

if (answer <= minAnswer || answer >= maxAnswer) {
revert Errors.OraclePriceFeedOutOfRange(address(priceFeed));
}

Here we are reverting if answer <= minAnsweror answer >= maxAnswer

Impact

This will revert the transaction if the answer is either of the min/max values.

Tools Used

Manual Review

Recommendations

- if (answer <= minAnswer || answer >= maxAnswer) {
+ if(answer < minAnswer || answer > maxAnswer){
revert Errors.OraclePriceFeedOutOfRange(address(priceFeed));
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
12 months ago
inallhonesty Lead Judge 11 months ago
Submission Judgement Published
Invalidated
Reason: Known issue

Support

FAQs

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