The update_price function in the ScrvusdOracleV2 contract calculates a new price based on the _parameters passed to it. However, the calculated new_price is not stored in the contract’s state, meaning that the contract does not persist the latest price after each update. This causes a situation where the contract will continue using outdated price data from previous price updates.
The update_price function computes a new price (new_price) based on the input _parameters. It compares new_price with the current price (current_price) and logs a PriceUpdate event. However, the calculated new_price is not saved to any state variables like last_prices. The last_prices array, which stores the previous prices, is not updated with the new price value. As a result, future calculations that rely on these prices will use outdated data, leading to inconsistencies in price feeds.
last_prices is updated with the results of _price_v0(), _price_v1(), and _price_v2(), but the actual new_price calculated in the function is not stored in last_prices. This means that the contract will continue to use the old price values instead of the newly computed price.
The absence of a persistent record of the new price means that subsequent price calculations (such as those performed by _price_v0, _price_v1, and _price_v2) will use stale prices.
This can lead to incorrect price data being fed to external systems, potentially causing price manipulations, incorrect financial calculations, or vulnerabilities in any system relying on this contract for accurate price feeds.
Without an updated price, the contract cannot provide a consistent or accurate price for scrvUSD, which undermines the reliability of the oracle.
Manual Review
Store the calculated new_price in a state variable like last_prices so that it can be used in future calculations. For example:
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.