At pool creation in QuantAMMWeightedPoolFactory both functions createWithoutArgs and create don't enforce the number of tokens to match the number of initial weights leading to errors with swapping
ex: a pool created with n tokens of 8 but only gave initialweights with a length of 4
a pool would be created for 4 tokens but registered on the vault with 8 tokens
The error appears when using swaps calling onSwap function from the vault as on the vault there are 8 tokens registered so he try to swap between ex: index 7 and index 0. The swap will revert with out of bounds as there are only 4 tokens in the pool not 8
Add this test function in QuantAMMWeightedPool2TokenTest
broken onSwap function
contradiction between tokens recorded for the pool in the vault and real ones
Manual review
Add an extra check when creating a pool to ensure that initialWeights length match tokens length
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.