In multiple update rule contracts (MomentumUpdateRule, PowerChannelUpdateRule, DifferenceMomentumUpdateRulem AntiMomentumUpdateRule), the validParameters function does not validate that the kappa vector length matches the number of assets. This can lead to incorrect normalization factor calculations when summing kappa values, as the function may sum more kappa values than there are assets.
In MomentumUpdateRule and other update rules, when using vector kappa mode, the normalization factor calculation sums all kappa values:
The issue arises in case that there are more kappa values in kappaStore than there is assets. This is possible because validParameters doesn't validate kappa vector length - it only checks that kappa values are greater than 0:
Example scenario:
Pool has 3 assets
Rule's kappa vector is initialized with 4 values: [1e18, 1e18, 1e18, 1e18]
In weight update process, normalization will sum all 4 kappas = 4e18
But weight updates only use first 3 values
Results in incorrect normalization factor: dividing by 4 instead of 3
I consider this medium severity because:
Leads to incorrect weight calculations due to wrong normalization factor used
Affects core pool feature of correctly updating the weights
It is a silent issue - there will be no failures or reverts, but weight calculations will be consistently off
Manual review
Add kappa vector length validation in validParameters, or when summing the sumKappa number of iterations should go up to the number of assets in pool.
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.