DSCEngine use oracle lib with a constant heartbeat (TIMEOUT) for every price feed. This will
On DSCEngine.sol, the constructor will add several token addresses and its corresponding chainlink priceFeed as supported collateral.
The comment says, it will support for example, ETH / USD, BTC / USD, MKR / USD pairs, and etc. Each of these pairs in Chainlink have its own heartbeat. For example ETH/USD is 3600 seconds (1 Hour), while BNB/USD, DOT/USD, ADA/USD are 86400 seconds (1 Day).
If we check OracleLib staleCheckLatestRoundData
function:
There is problem with Line 30 validation is TIMEOUT is a constant set in the contract with the value of 36060 seconds, so it just restricts the data to not be outdated more than 3 hours. Usually Chainlink price feeds are updated much more frequently than that but there were some times that some price feeds took up a little bit more than 3 hours to update themselves with the most recent price.
The different pairs have diferrent heartbeats. Using the same TIMEOUT (ORACLE_FRESHNESS_THRESHOLD, heartbeat) for all the price feeds is not correct becuase the freshness validation would be useless for some pairs which can return stale data.
This can lead to potential price issues due to different pairs have different TIMEOUT (heartbeat)
Manual analysis
Do not hardcode the TIMEOUT (heartbeat) threshold and use the corresponding heartbeat ORACLE_FRESHNESS_THRESHOLD for each token
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.