The ScrvusdOracleV2.vy
contract lacks proper timestamp validation in the update_price()
function, While it checks block numbers, it fails to validate the freshness of price data through timestamp checks, potentially allowing stale prices to be used.
In ScrvusdOracleV2.vy
, the update_price()
function only validates block numbers:
Critical issues:
No validation of _ts
against current block.timestamp
No maximum age check for price data
No heartbeat verification
Missing checks for future timestamps
No minimum update interval enforcement
Price Staleness:
Outdated prices could be used for critical operations
Potential for price manipulation through delayed updates
Risk of incorrect liquidations or unfair trades
System Risks:
Protocol could operate on stale data during market volatility
MEV opportunities through price update manipulation
Potential economic attacks through strategic update timing
Manual code review
Temporal analysis
Implement Comprehensive Timestamp Validation:
Add Heartbeat Verification:
Implement Price Deviation Checks:
Add Emergency Circuit Breaker:
These improvements provide:
Strict timestamp validation
Heartbeat verification
Price deviation checks
Emergency circuit breaker
Clear error messages and logging
The implementation should use all these mechanisms together to ensure robust price updates and prevent stale or manipulated data from being used.
I believe this to be at best informational severity as - The moment sequencer is up again, the price updates that retrieve storage values from mainnet will be pushed. To note, price updates are retrieved from storage proofs are retrieved from Ethereum scrvUSD contract, so the concept of the next updated price being outdated is not possible, given mainnet does not utilize sequencers. - There are no problems with small lags if used in liquidity pools due to fees. Fees generate spread within which price can be lagged. - All price updates are subjected to smoothing, and as you can see from the historical price movements as seen [here](https://coinmarketcap.com/currencies/savings-crvusd/), there is never a large discrepancy in prices (absolute terms), and even more unlikely given sequencer downtimes will unlikely be long. This small price changes can be safely arbitrage aligning with [protocol design](https://github.com/CodeHawks-Contests/2025-03-curve?tab=readme-ov-file#parameters) , along with the above mentioned fees - Combined with the above, the max price increments can be temporarily increased to more effectively match the most updated price.
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.