The OracleLib
contract fetches the latest round data from a Chainlink oracle. However, the contract doesn't check for the completeness of the latest round. This could potentially result in the use of incomplete or stale prices, which might disrupt functions relying on accurate price data and can lead to incorrect calculations or operations, and in certain scenarios, loss of funds.
The OracleLib
contract retrieves the latest round data from a Chainlink oracle using the latestRoundData()
function. Although the contract checks if the data is older than a predefined TIMEOUT
, it doesn't check for the completeness of the latest round. According to Chainlink's documentation, latestRoundData()
doesn't error out if no consensus has been reached for the latest round; instead, it returns 0 or data from the previous round.
In this function, priceFeed
is a reference to a Chainlink oracle. The function retrieves the latest price and timestamp and checks if the data is stale. However, it doesn't check if the latest round of data is complete.
Functions that rely on accurate price data might not work as expected if the data is incomplete or stale.
Manual review
Check for round completeness: when calling latestRoundData()
, check whether the latest round of data is complete. If it isn't, handle this situation appropriately to prevent the use of incomplete or stale price data.
Here is a code example:
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.