The _setRule function accepts several array inputs:
_initialWeights
_ruleIntermediateValues
_initialMovingAverages
_poolSettings.lambda
However, the function lacks comprehensive checks to ensure that these arrays:
Have consistent lengths where required
Meet minimum or expected size constraints.
Mismatched array lengths could trigger out-of-bounds array access, leading to transaction reverts.
If the function does not revert but initializes incorrectly, the pool could be left in a misconfigured state, affecting its functionality and security.
The contract could end up in a misconfigured state, potentially causing weight calculations or other pool logic to fail.
Missing validation can result in silent misconfigurations that cause downstream issues in pool operations or weight calculations.
Manual Code Review
Formal Verification Tools
Add validations for all array inputs to ensure they are non-empty and consistent in length where required:
Set upper bounds for the lengths of input arrays to prevent excessive gas consumption:
Ensure all array inputs align with the pool's logic. For example:
_poolSettings.lambda length must match _initialWeights in vector scenarios.
Other inputs should have consistent sizes based on their usage in external calls.
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.