The LibOracle::getOraclePrice()
lacks a preventive approach to handling the case of the Chainlink's latestRoundData()
reverts, resulting in a permanent denial of service to the Ditto
protocol.
The getOraclePrice()
makes use of Chainlink's latestRoundData()
in L32 and L55 to get the latest prices for the USD asset (ETH/USD feed) and an asset other than the USD, respectively. The calls to the latestRoundData()
can be reverted for several reasons, such as Chainlink's multisigs block access to price feeds, etc.
However, there is no preventive approach to handling the case of the latestRoundData()
reverts, resulting in a permanent denial of service to the Ditto
protocol.
The use of Chainlink's latestRoundData() for USD asset (ETH/USD feed)
: https://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/libraries/LibOracle.sol#L32
The use of Chainlink's latestRoundData() for an asset other than the USD
: https://github.com/Cyfrin/2023-09-ditto/blob/a93b4276420a092913f43169a353a6198d3c21b9/contracts/libraries/LibOracle.sol#L55
Chainlink's latestRoundData()
reverts can permanently brick the Ditto
protocol.
Manual Review
Wrap both calls (in L32 and L55) to the latestRoundData()
in try/catch blocks and handle any errors appropriately (e.g., fallback to Uniswap's TWAP oracle).
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.