Chainlink Oracle's latestRoundData() function may return price data which is not fresh or incorrect price data in results
Summary
Chainlink's latestRoundData() function is used but there is no check if the return value indicates price data which is not fresh. This could lead to getting price data which is not fresh.
(This is according to the Chainlink documentation: https://docs.chain.link/docs/historical-price-data/#historical-rounds )
Vulnerability Detail
Chainlink Oracle's latestRoundData() function is used in the initializePools() function in the MarketExtended.sol for getting the latest price.
However, there is no check if the return value indicates the price data which is not fresh.
Impact
The result of calling oracleManager.chainlinkOracle().latestRoundData() could return price data which is not fresh. Then, the price data which is not fresh will be assigned into the variable of "initialAssetPrice" .
(Also, it will be emitted when the SeparateMarketLaunchedAndSeeded() event will be emitted in the initializePools() function in the MarketExtended.sol)
0xmuxyz
medium
Chainlink Oracle's
latestRoundData()
function may return price data which is not fresh or incorrect price data in resultsSummary
latestRoundData()
function is used but there is no check if the return value indicates price data which is not fresh. This could lead to getting price data which is not fresh. (This is according to the Chainlink documentation: https://docs.chain.link/docs/historical-price-data/#historical-rounds )Vulnerability Detail
latestRoundData()
function is used in theinitializePools()
function in the MarketExtended.sol for getting the latest price.Impact
oracleManager.chainlinkOracle().latestRoundData()
could return price data which is not fresh. Then, the price data which is not fresh will be assigned into the variable of"initialAssetPrice"
. (Also, it will be emitted when theSeparateMarketLaunchedAndSeeded()
event will be emitted in theinitializePools()
function in the MarketExtended.sol)Code Snippet
Tool used
Recommendation
require(answeredInRound >= latestRoundId, "Price is not fresh"); require(block.timestamp - updatedAt < PRICE_ORACLE_THRESHOLD_WHICH_IS_NOT_FRESH, "Price round incomplete");