The QuantAMMWeightedPoolFactory contract fails to validate that disableUnbalancedLiquidity is set to true when a pool's hook has enableHookAdjustedAmounts enabled, allowing pools to be created with invalid configurations that could lead to unexpected behavior.
Root cause
In QuantAMMWeightedPoolFactory, the createWithoutArgs and create functions do not validate the relationship between disableUnbalancedLiquidity and hook settings.
The root of the problem is that there is no validation that disableUnbalancedLiquidity should be true when the hook has the flag enableHookAdjustedAmounts=true.
Although there are comments indicating the need for validation:
Factory directly uses the value of `params.disableUnbalancedLiquidity` without validation.
Add this to QuantAMMWeightedPoolFactory.t.sol and run it forge test --match-test testLiquidityManagementValidation -vvvv.
Trace:
When creating the pool, disableUnbalancedLiquidity is set to false when it should be true.
The pool was successfully initialized with unbalanced liquidity. The first token is 1000 units (1e21) while the second token is only 500 units (5e20).
There is no validation or revert when adding unbalanced liquidity.
Pool successfully initialized and status confirmed.
Pools can be created with invalid configurations
Unbalanced liquidity operations could be allowed when they should be restricted
Manual review
Foundry
Add validation in the factory's create functions.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelyhood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.
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.