code-423n4 / 2024-05-olas-findings

12 stars 3 forks source link

Upgraded Q -> 2 from #34 [1720018773609] #118

Closed c4-judge closed 2 months ago

c4-judge commented 2 months ago

Judge has assessed an item in Issue #34 as 2 risk. The relevant finding follows:

[L-11] Inaccurate nominee weights may be returned by _getWeight() for unused nominees

The _getWeight() function fills in historic nominee weights week-over-week for up to MAX_NUM_WEEKS (53 weeks). However, any number of nominees can be permissionlessly added via addNomineeEVM() or addNomineeNonEVM() and remain unused for over 53 weeks.

In this scenario, it is not feasible to ensure that every nominee is checkpointed within that 53 week period. If a nominee is not checkpointed for over 53 weeks, _getWeight() would return a nominee weight value that is higher than the actual current bias, as the loop exits after 53 iterations.

This inaccurate weight value is then used throughout the protocol, as the return value of _getWeight() is considered accurate under all circumstances. This could lead to incorrect relative weights and sums being used.

Consider implementing logic that allows the calling function to revert if the _getWeight() return value is from a nominee that hasn't been checkpointed in over 53 weeks, instead of unconditionally using a potentially stale value.

c4-judge commented 2 months ago

0xA5DF marked the issue as duplicate of #64

c4-judge commented 2 months ago

0xA5DF marked the issue as satisfactory