Submitted by 0xb0k0, also found by Tigerfrake, Bigsam, MSaptarshi, JC, Kaysoft, unix515, Pelz, 0xHash, Norah (1, 2), Bauchibred, biakia, nnez, mt030d, ayden, Neo_Granicen, 0xAkira, golu, atoko (1, 2), emmac002, WinSec, y0ng0p3, web3km, steadyman, 0xMilenov, Naresh, josephdara, Eeyore, lydia_m_t, Abhan, 0xabhay, Tripathi, dyoff, pkqs90, shaflow2, SpicyMeatball, Sathish9098, forgebyola, Sparrow, ZanyBonzy, and 0xlucky
In the PriceFeed contract, the protocol uses a ChainLink aggregator to fetch the latestRoundData(), but there is no check if the return value indicates stale data. The only check present is for the quoteAnswer to be > 0; however, this alone is not sufficient.
The protocol mentions that:
However, this stale period check is only currently applied to the Pyth integration, where the ChainLink feed is not considered for stale data.
This could lead to stale prices according to the Chainlink documentation here.
This discrepancy could have the protocol produce incorrect values for very important functions in different places across the system, such as GammaTradeMarket, PositionCalculator, LiquidationLogic, etc.
https://github.com/code-423n4/2024-05-predy/blob/a9246db5f874a91fb71c296aac6a66902289306a/src/PriceFeed.sol#L46https://github.com/code-423n4/2024-05-predy/blob/a9246db5f874a91fb71c296aac6a66902289306a/src/libraries/PositionCalculator.sol#L141
Consider adding missing checks for stale data:
Oracle
syuhei176 (Predy) confirmed
0xsomeone (judge) commented:
