The UpdateWeightRunner.sol#performUpdate() function can always revert under certain conditions.
The performUpdate() function in UpdateWeightRunner.sol can revert due to boundary cases where the calculated weights become negative. This issue arises from the _getWeights() function in various update rule contracts, which does not handle cases where weights can be less than zero, causing the protocol to freeze during weight updates.
The AntimomentumUpdateRule.sol#_getWeights() function is implemented as follows:
At line L119, the locals.normalizationFactor is a weighted average of locals.newWeights[locals.i] by kappa. Therefore, locals.normalizationFactor - locals.newWeights[locals.i] can be less than zero. In boundary cases, int256(locals.kappa[locals.i]).mul(locals.normalizationFactor - locals.newWeights[locals.i]) can result in res < 0, causing a guard rail failure. Consequently, UpdateWeightRunner.sol#performUpdate() will always revert in such cases. Additionally, there is no underflow check between lines L99~L104.
The UpdateRule.sol#L195~L203 code is as follows:
As shown above, the protocol retrieves unguarded weights from the _getWeights() function and then guards the weights using clamping. There is no assumption that weights are always greater than zero. However, in some cases, the real implementation causes a revert due to underflow when kappa is provided as a vector instead of a scalar. When this boundary case occurs, the protocol is frozen for updating weights.
This issue also exists in ChannelFollowingUpdateRule.sol, DifferenceMomentumUpdateRule.sol, MomentumUpdateRule.sol, and PowerChannelUpdateRule.sol.
The _getWeights() functions should be modified to prevent reversion when weights go below zero. For example, the AntimomentumUpdateRule.sol#_getWeights() function should be modified by removing the following line:
_clampWeights will check that these weights are positive and in the boundaries before writing them in storage.
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.