osmosis icon indicating copy to clipboard operation
osmosis copied to clipboard

x/incentives: investigate `checkFinishDistribution`

Open mattverse opened this issue 3 years ago • 1 comments

Background

As of now checkFinishDistribution assumes that filled Epoch has not been incremented when this method has been called, thus checks that the specific gauge has finished by checking that number of epochs paid over is greater than filled epochs + 1. This calculation can be potentiall wrong, as we might have called this function having done operations for fiiled_epochs+1, which could be resulting not paying out the last epoch of rewards.

Further investigation and fixes are needed to confirm that this is not the case, OR if this is the case fixes are applied so that the last epoch of rewards are payed out.

Acceptance Criteria

  • [ ] check if we are calling checkFinishDistribution having incremented filled_epochs +1.
    • if this is the case, confirm that we are currently not paying out the last epoch
    • introduce a fix for this bug

mattverse avatar Jul 12 '22 10:07 mattverse

Hi sir @mattverse, I am handling this issue but confusing about your comment.
As now, I see that checkFinishDistributioncalled then filled epoch is increased (like the comment in this func) and then checking number of epochs paid over is small than or equal to filled epochs + 1 (difference from your comment). Can you plz check this and make more explicit? Thanks https://github.com/osmosis-labs/osmosis/blob/fcade39a82e8db7fbd984117407cde934a39761d/x/incentives/keeper/distribute.go#L375-L384

ThanhNhann avatar Oct 03 '22 05:10 ThanhNhann