You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some parts of the code may be simplified, to make them more easily understandable and maintainable. Below is a non-exhaustive list of such snippets:
In withdrawLQTY() there is an if-else clause ensuring that the user's unallocatedOffset goes to 0 in case of a complete withdrawal. However, the fraction formula used in the if branch would already yield offsetDecrease == unallocatedOffset in this case, without the need for a special case.
In allocateLQTY(), the FSM check on DISABLED initiatives is redundant: the require will never fail. This is because the previous check on "active votes" already implies that, for all other states, both deltas should be non-positive. In fact, this holds not just for the DISABLED state, but also UNREGISTERABLE.
In _allocateLQTY(), updating the GlobalState is done by subtracting the prevInitiativeState and adding the new initiativeState. However, this could be simplified by simply adding the relevant user-supplied delta, and suppressing the prevInitiativeState altogether.
All payout snippets (in claimForInitiative(), BribeInitiative.claimBribes(), CurveV2GaugeRewards._depositIntoGauge()) include some capping logic, to account for potential errors leading to insolvency. However, the main source of rounding errors that led to broken accounting (i.e. using the average timestamp to represent lines) has been removed in [Version 3]. Moreover, should some other sources of error be left undiscovered, this mitigation still does not adequately protect against them: it only makes sure that the "last" payout does not revert, possibly at the expense of other destinations of those funds, without addressing the root cause that led to incorrect payout calculations.
The text was updated successfully, but these errors were encountered:
Some parts of the code may be simplified, to make them more easily understandable and maintainable. Below is a non-exhaustive list of such snippets:
In
withdrawLQTY()
there is an if-else clause ensuring that the user'sunallocatedOffset
goes to 0 in case of a complete withdrawal. However, the fraction formula used in the if branch would already yieldoffsetDecrease == unallocatedOffset
in this case, without the need for a special case.In
allocateLQTY()
, the FSM check onDISABLED
initiatives is redundant: the require will never fail. This is because the previous check on "active votes" already implies that, for all other states, both deltas should be non-positive. In fact, this holds not just for theDISABLED
state, but alsoUNREGISTERABLE
.In
_allocateLQTY()
, updating theGlobalState
is done by subtracting theprevInitiativeState
and adding the newinitiativeState
. However, this could be simplified by simply adding the relevant user-supplied delta, and suppressing theprevInitiativeState
altogether.All payout snippets (in
claimForInitiative()
,BribeInitiative.claimBribes()
,CurveV2GaugeRewards._depositIntoGauge()
) include some capping logic, to account for potential errors leading to insolvency. However, the main source of rounding errors that led to broken accounting (i.e. using the average timestamp to represent lines) has been removed in [Version 3]. Moreover, should some other sources of error be left undiscovered, this mitigation still does not adequately protect against them: it only makes sure that the "last" payout does not revert, possibly at the expense of other destinations of those funds, without addressing the root cause that led to incorrect payout calculations.The text was updated successfully, but these errors were encountered: