In ChainlinkUtil::getPrice
function, the price range check implementation is useless because it is already done by OffchainAggregator.sol
in Chainlink codebase.
In LightChaserV3 report: Medium-5, this known issue does not highlight the actual problems in ChainlinkUtil::getPrice
function. Merely just saying that price is not validated is a vague finding.
The issue that I am reporting here pertains to the implementation of and reliance on a redundant price range check in ChainlinkUtil::getPrice
function. Because this check is already implemented by Chainlink itself in OffchainAggregator::transmit
function.
Furthermore, the issue here is that we are fetching a value from a source and then validating the fetched value against other values fetched from the same source.
Source:ChainlinkUtil.sol#L59C1-L75C10
The computation and logical implementation of price of collateral assets sits at the heart of a perpetuals DEX protocol like Zaros.
As a consequence of wrong collateral asset price computations, positions may be liquidated prematurely or fail to liquidate when they should and eventually resulting bad debts. Positions open on wrong collateral prices which may cost major financial losses to the protocol. Incorrect collateral valuation can cause undercollateralization.
Below is the code from Chainlink OffchainAggregator::transmit
function. OffchainAggregator.sol#L681 has implemented this check beforehand.
Manual review
Existing price range check should be removed and range should be validated either by using the values retreived from another external source or values set in the configurations by the owner.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.