DeFiLayer 1Layer 2
14,723 OP
View results
Submission Details
Severity: low
Invalid

Inaccurate Initial Price Calculation Due to Deployment Parameters

Summary

The update_price function is responsible for updating the token price based on supplied parameters that are verified by a prover and a verifier. However, after deployment, the initial parameters are set to very small values. When update_price is called for the first time, it calculates the token price using these initial parameters, which leads to incorrect pricing.

Vulnerability Details

At deployment, self.price_params is initialized with minimal values:

self.price_params = PriceParams(
total_debt=0,
total_idle=1,
total_supply=1,
full_profit_unlock_date=0,
profit_unlocking_rate=0,
last_profit_update=0,
balance_of_self=0,
)

In update_price, current_price is calculated using outdated parameters before updating self.price_params:

ts: uint256 = self.price_params_ts
current_price: uint256 = self._raw_price(ts, ts) # Uses outdated params

Since the initial parameters contain small values, this results in an incorrect price calculation, inflating the first reported price.

Impact

The first call to update_price after deployment will use the initial small parameters, leading to inaccurate price updates

Tools Used

Manual Review

Recommendations

Initialize price_params with realistic values at deployment or ensure the first price update correctly accounts for external market conditions to prevent inaccurate pricee.

Updates

Lead Judging Commences

0xnevi Lead Judge 2 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

finding-hardcoded-initial-price

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.