# get_fee_growth_inside in tick.rs should allow for underflow/overflow but doesn't

Superposition's tick.rs uses checked math for fee growth inside, so legitimate underflows revert, bricking positions and blocking liquidation.

- Payout: Audit contest
- Severity: high
- Program: Superposition
- Found by: SBSecurity
- Disclosed: 2024-10-18
- Write-up quality: 6/10
- Original: https://github.com/code-423n4/2024-08-superposition-findings/issues/46
- Library page: https://bugbountylibrary.com/r/c4%3A2024-08-superposition%3AH-06
- Tags: area:web3 domain:web3 impact:dos kind:contest platform:code4rena sev:high tech:rust tech:solidity technique:regression technique:source-review vuln:accounting-error vuln:dos

**Target:** Seawater AMM tick.rs fee growth accounting
**Root cause:** get_fee_growth_inside uses checked_sub for fee_growth_global - below - above, but Uniswap v3 relies on intentional wrapping underflow; checked math returns Error::FeeGrowthSubTick instead of wrapping.
**Steps:**
1. Call any operation depending on fee growth (e.g. liquidation) for a position whose fee_growth_global_0 < fee_growth_below_0 + fee_growth_above_0
2. Observe checked_sub returns None -> Error::FeeGrowthSubTick
3. Operation reverts, position becomes inaccessible
**How found:** Compared Superposition's Rust port against Uniswap v3 PositionLibrary (Solidity <0.8) and the known Uniswap v3-core#573 issue, noting the port replaced wrapping arithmetic with checked math, violating the stated 'faithful UniswapV3 math' invariant.
**Exploitation:** Not weaponized; the flaw causes legitimate operations like liquidation to revert, making affected positions permanently inaccessible (funds locked).
**Insight:** When porting Solidity <0.8 code to Rust/checked-math languages, audit every subtraction that relied on intentional wrapping (fee growth accumulators, tick math); checked math silently converts valid wrap-around into reverts that brick positions.

