Missing update current tick when we call set_sqrt_price_F_F_4_D_B_98_C() #63
Labels
bug
Something isn't working
downgraded by judge
Judge downgraded the risk level of this issue
grade-b
primary issue
Highest quality submission among a set of duplicates
Q-11
QA (Quality Assurance)
Assets are not at risk. State handling, function incorrect as to spec, issues with clarity, syntax
sponsor acknowledged
Technically the issue is correct, but we're not going to resolve it for XYZ reasons
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: