_beforeSwap() should safely derive a non‑negative swapAmount from SwapParams.amountSpecified by taking its absolute value. This value is then used for fee selection and event emission without causing unexpected reverts.
The code computes swapAmount using unary negation for negative inputs. Negating type(int256).min (i.e., INT256_MIN = -2^255) overflows in Solidity 0.8+ and reverts with a panic error before the swap proceeds. A router or integrator that (intentionally or accidentally) passes amountSpecified == INT256_MIN will cause _beforeSwap to revert immediately.
Likelihood: Low
Occurs whenever an integrator or test harness supplies amountSpecified == type(int256).min. This may surface in fuzzing, adversarial inputs, or poorly validated custom routers.
While standard Uniswap routers are unlikely to set this exact value, the hook should be robust against such inputs.
Impact: Low
Unexpected revert / DoS path: The hook reverts before Uniswap’s pool logic runs, causing swap failures and potentially blocking certain test or integration scenarios.
Reduced resilience: Fuzzing and adversarial testing will hit this edge case, undermining reliability until addressed.
Add this test to TestReFiSwapRebateHook to demonstrate the revert caused by negating INT256_MIN:
Add guard against INT256_MIN
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.