The getSqrtPrice function queries chainlink's latestRoundData but doesn't check if the price returned is stale. Using a stale price can cause the calculations depending on the getSqrtPrice function to be inaccurate, which, for example, can mistakenly consider a user to be ripe for liquidation when in reality they're not and unexpectedly allow the user to be liquidated.
Judge has assessed an item in Issue #252 as 2 risk. The relevant finding follows:
6. No check for stale prices upon querying chainlink tokens
Links to affected code *
https://github.com/code-423n4/2024-05-predy/blob/a9246db5f874a91fb71c296aac6a66902289306a/src/PriceFeed.sol#L46
Impact
The
getSqrtPrice
function queries chainlink'slatestRoundData
but doesn't check if the price returned is stale. Using a stale price can cause the calculations depending on thegetSqrtPrice
function to be inaccurate, which, for example, can mistakenly consider a user to be ripe for liquidation when in reality they're not and unexpectedly allow the user to be liquidated.Recommended Mitigation Steps
Consider checking for stale prices.