The current implementation lacks essential checks for data staleness, round completion verification, and proper timestamp validation, which could lead to the consumption of invalid or stale price data.
The current implementation in ChainlinkOracle.sol handles price feed data as follows:
The implementation only validates that the returned price is greater than zero. This single check is insufficient for ensuring price feed reliability and accuracy.
The core issue stems from ignoring critical fields returned by latestRoundData(). The AggregatorV3Interface.sol contract specifically includes these fields for validation purposes:
The contract may use outdated price data since it doesn't verify the updatedAt timestamp against the current block timestamp. This could lead to trade executions at incorrect prices.
It could also use data from an incomplete round since it doesn't verify the round's completion status through timestamp checks.
Without validating answeredInRound against roundId, the contract might use price data from an incorrect round, potentially from a previous state of the market.
The following implementation includes all necessary validations:
LightChaser: ## [Medium-4] Insufficient oracle validation
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.