There are some issues in the DifferenceMomentumUpdateRule, I discussed with sponsor but he was also not sure wether it's dead code, wrong natspac or what is going on, so he asked me to report it so here are the issues.
The NatSpec comment for _setInitialIntermediateValues
function claims it sets gradient values, but the code actually sets moving averages.
There's a useless loop in _getWeights
function that wastes extra gas on each call:
The parameter docs says there are 3 parameters including "Lambda Long", but the code only uses 2 parameters (kappa and lambda short).
Wrong NatSpec: Developers might use the function incorrectly, thinking it handles gradients when it actually handles moving averages.
Dead Code: Every call to _getWeights
wastes gas by running an empty loop that does nothing.
Parameter Mismatch: Developers will try to provide 3 parameters because docs say so, but the code only handles 2, leading to function calls failing.
Either fix the NatSpec comment to say "moving averages" instead of "gradient", or modify the code to handle gradients if that was intended.
Remove the empty loop in _getWeights
since it serves no purpose and only wastes gas.
Either:
Update parameterDescriptions
to show only 2 parameters, or
Implement the missing "Lambda Long" parameter functionality in the code
The sponsor should clarify if the moving average vs gradient discrepancy is a docs error or implementation error to ensure the correct fix is applied.
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.