Describe the normal behavior in one or more sentences
Explain the specific issue or problem in one or more sentences
Likelihood:
* This occurs when the owner calls `ChangeFee` with invalid fee values
* Accidental misconfiguration or malicious owner action can trigger this
Impact:
* Swaps will revert when fees exceed the maximum, breaking pool functionality
* The hook's `_beforeSwap` will return invalid fees that cause `LPFeeLibrary.removeOverrideFlagAndValidate()` to revert
* Pool becomes unusable until fees are corrected
Add validation before setting fees using `LPFeeLibrary.validate()` to ensure fees don't exceed `MAX_LP_FEE` (1,000,000). This prevents invalid fees from being stored and protects the pool from being bricked.
```diff
// src/RebateFiHook.sol:23
using LPFeeLibrary for uint24;
// src/RebateFiHook.sol:84-92
function ChangeFee(
bool _isBuyFee,
uint24 _buyFee,
bool _isSellFee,
uint24 _sellFee
) external onlyOwner {
+ if(_isBuyFee) {
+ _buyFee.validate(); // Reverts with LPFeeTooLarge if > MAX_LP_FEE
+ }
+ if(_isSellFee) {
+ _sellFee.validate(); // Reverts with LPFeeTooLarge if > MAX_LP_FEE
+ }
if(_isBuyFee) buyFee = _buyFee;
if(_isSellFee) sellFee = _sellFee;
}
```
**Explanation:**
The fix validates fees before state changes using `LPFeeLibrary.validate()`, which checks if fees are <= `MAX_LP_FEE` (1,000,000). Invalid fees revert with `LPFeeTooLarge(fee)` before being stored, preventing pool bricking. This ensures fees always comply with Uniswap V4's requirements and are caught at configuration time rather than during swaps.
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.