Fees calculations don’t allow overflowing/underflowing #38
Labels
3 (High Risk)
Assets can be stolen/lost/compromised directly
bug
Something isn't working
duplicate-46
edited-by-warden
🤖_54_group
AI based duplicate group recommendation
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/tick.rs#L236-L245
Vulnerability details
Impact
update_position
-related transactions may revert in some situations.Vulnerability Details
In the
get_fee_growth_inside
function, the calculations offee_growth_global_0
,fee_growth_global_1
, etc. don’t allow under- and overflowing. However, the respective calculations in Uniswap V3 are designed to underflow and overflow (for more information, refer to Uniswap/v3-core#573 issue and Jeiwan/uniswapv3-book#45). As a result, executingupdate_position
can revert in some situations (such as testincr_position_fee_growth_tick
), causing transaction reverts.Tools Used
Manual analysis
Recommended Mitigation Steps
Use
overflowing_sub
instead ofchecked_sub
.Assessed type
Under/Overflow
The text was updated successfully, but these errors were encountered: