The calculation of price_v0
contains a timestamp handling flaw in the update_price()
function that affects unlocked shares evaluation. When self.price_params_ts
is set to last_profit_update
, any subsequent calculations using this timestamp incorrectly determine that no shares are unlocked, even when full_profit_unlock_date > ts
. Furthermore, the unlocked shares calculation only proceeds when full_profit_unlock_date != 0
. The combination of these conditions creates scenarios where unlocked shares consistently evaluate to zero, compromising the accuracy of price valuations in the oracle system.
This originates from the logic flow surrounding the calculation of unlocked_shares
during price_vo
computation. Below is the sequence leading to the vulnerability:
When calculating price_vo
, the system calls self_raw_price()
with self.price_params_ts
and self.price_params_last_profit_update
as parameters.
Inside self_raw_price()
, the function obtain_price_params()
is called using self.price_params_last_profit_update
as its argument.
Within obtain_price_params()
, the condition:
evaluates to True
.
This causes an early return of params
, bypassing further logic that might adjust or update parameters.
The returned params
are used to calculate total_asset()
and total_supply()
.
total_supply()
calls unlocked_shares()
In update_price()
, self.price_params_ts
is explicitly set to last_profit_update
as it is mentioned in a comment in ScrvusdVerfierV1
contract
In unlocked_shares()
, the ts
argument is equal to last_profit_update
. Therefore _unlocked_shares()
will be zero since the ts - last_profit_update
is zero
The unlocked shares are only considered if:
This means:
If full_profit_unlock_date > ts
(even if not zero), unlocked shares will still be zero.
This vulnerability leads to unlocked shares being incorrectly calculated as zero under the described conditions. The key consequences are with unlocked shares ignored or set to zero, total_supply()
underestimates the circulating supply, leading to inflated or inaccurate price_vo
values.
Manual Review
Ensure that the comparison:
does not prematurely zero out unlocked shares unless this behavior is explicitly desired
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.