When the protocol lacks a backup oracle, it bypasses the oracle staleness check. During liquidity removal, the upliftFee is charged based on price increases using the latest oracle price. If the oracle data is stale, it becomes unclear whether the upliftFee should be applied or not.
During removeLiquidity, the hookAdjustedAmountsOutRaw is calculated in the hook contract based on price changes. In the onAfterRemoveLiquidity function, either a withdrawalFee or an upliftFee is subtracted from hookAdjustedAmountsOutRaw.
When there is no backup oracle and the primary oracle is stale, the staleness check in the getData function can be bypassed, potentially leading to incorrect data usage.
From the above code, if optimisedOracles returns a stale price, the control moves to the else block. If no backup oracle exists, the stale optimisedOracles response is returned at line 386. This leads to the following consequences:
Missed Fees: If the market price has increased while the stale oracle shows lower price, the protocol fails to collect the correct upliftFee, resulting in a potential loss.
Overcharging LPs: If the market price has decreased but the stale oracle reports a higher price, liquidity providers may be overcharged, causing a loss for them.
Failure to properly detect and handle stale oracle prices can result in:
Protocol Losses: Missing the opportunity to charge the correct upliftFee when market prices have increased.
Liquidity Provider Losses: Overcharging LPs with an excessive upliftFee based on stale and incorrect price data.
Manual Review
To address the risks of stale oracle data, consider the following approaches:
Disable Withdrawals: Temporarily halt the withdrawal functionality if the oracle is found to be stale, ensuring no transactions occur based on outdated prices.
Allow Fee-Free Withdrawals: If the pool relies on a single oracle that is stale, and the protocol opts to continue allowing withdrawals, suspend fee charges until reliable price updates are restored.
Cyfrin audit: 7.2.4 Stale Oracle prices accepted when no backup oracles available
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.