Chainlink's latestRoundData might return stale or incorrect results
Summary
Chainlink's latestRoundData() is used but there is no check if the return value indicates stale data. This could lead to stale prices according to the Chainlink documentation:
The PricerInternal._latestAnswer64x64 function uses Chainlink's latestRoundData() to get the latest price. However, there is no check if the return value indicates stale data.
Impact
The PricerInternal could return stale price data for the underlying asset.
/**
* @notice gets the latest price of the underlying denominated in the base
* @return price of underlying asset as 64x64 fixed point number
*/
function _latestAnswer64x64() internal view returns (int128) {
(, int256 basePrice, , , ) = BaseSpotOracle.latestRoundData();
(, int256 underlyingPrice, , , ) =
UnderlyingSpotOracle.latestRoundData();
return ABDKMath64x64.divi(underlyingPrice, basePrice);
}
berndartmueller
medium
Chainlink's
latestRoundData
might return stale or incorrect resultsSummary
Chainlink's
latestRoundData()
is used but there is no check if the return value indicates stale data. This could lead to stale prices according to the Chainlink documentation:Vulnerability Detail
The
PricerInternal._latestAnswer64x64
function uses Chainlink'slatestRoundData()
to get the latest price. However, there is no check if the return value indicates stale data.Impact
The
PricerInternal
could return stale price data for the underlying asset.Code Snippet
PricerInternal._latestAnswer64x64
Tool Used
Manual review
Recommendation
Consider adding checks for stale data. e.g