In DifferenceMomentumUpdateRule.sol, precision loss occurs along with the possibility of the exponentially weighted moving average (EWMA) portion changing to ‘0’ when the EWMA(long) exceeds ‘1’.
In the function _getWeights of DifferenceMomentumUpdateRule contract, for the computation of ((EWMA_short - EWMA_long) / EWMA_long), reciprocal of EWMA_long is computed and then this is multiplied with (EWMA_short - EWMA_long).
The issue with this approach is (i) precision loss (ii) the reciprocal will be ‘0’ the moment EWMA_long crosses ONE.
Manual review
Consider doing direct division. The suggested line #105 can be modified as
## [Low-24] Divide before multiply
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.