Missing update current tick when we call set_sqrt_price_F_F_4_D_B_98_C() #30
Labels
2 (Med Risk)
Assets not at direct risk, but function/availability of the protocol could be impacted or leak value
bug
Something isn't working
sufficient quality report
This report is of sufficient quality
Lines of code
https://github.com/code-423n4/2024-08-superposition/blob/4528c9d2dbe1550d2660dac903a8246076044905/pkg/seawater/src/lib.rs#L1078-L1092
Vulnerability details
Impact
When we update the sqrt price via set_sqrt_price_F_F_4_D_B_98_C(), the pool's cur tick is not updated timely. This will cause that cur_tick is incorrect. Calculations based on
cur_tick
will be wrong.Proof of Concept
In lib.rs, if one pool is misconfigured at the beginning of the pool's life, we can update the pool's sqrt price via function set_sqrt_price_F_F_4_D_B_98_C().
The problem is that the pool's cur tick is calculated based on the sqrt price. We only update the sqrt price, missing update the
cur_tick
.For example:
cur_tick
will be calculated based on the incorrect sqrt price.set_sqrt_price_F_F_4_D_B_98_C
.But the
cur_tick
is still incorrect.Tools Used
Manual
Recommended Mitigation Steps
Update the related
cur_tick
when we update the sqrt price.Assessed type
Context
The text was updated successfully, but these errors were encountered: