AntFleet

Disagreement · 1e8fb4a1-anthropic-12

FeesManager.collectFees casts int128 amounts to uint128 without sign check; negative deltas would wrap

solo Opus
repo a7cc2ed7·PR #1·reviewed 1 week ago

Opus finding

FeesManager.collectFees casts int128 amounts to uint128 without sign check; negative deltas would wrap

mediumbugmedium
  • src/base/FeesManager.sol:86-94
`BalanceDelta.amount0/1` return int128. The cast `uint128(int128)` reinterprets bits: a negative value (which shouldn't occur for a collect, but could from a buggy or unusual `_collectFees` implementation) would become a huge uint128 and silently inflate `getCumulatedFees`. The override in StreamableFeesLockerV2 calls `_collect` which performs `poolManager.modifyLiquidity(..., liquidityDelta=0)` — feesAccrued from this is always non-negative for non-malicious pools. But a hostile/buggy hook could return negative. Adding a SafeCast.toUint128 guard would be safer.

Recommendation

Use `SafeCast.toUint128(int128)` or `require(fees.amount0() >= 0)` before casting.

Other reviewer

The other reviewer flagged nothing in this file/line range.

Why this didn't post

This finding didn't meet AntFleet's unanimous agreement threshold. Both frontier models review every PR independently; only findings they both flag with the same severity and category are posted to the PR. This one fell through.

read the methodology →