Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/incentives: investigate checkFinishDistribution #2031

Open
1 task
mattverse opened this issue Jul 12, 2022 · 1 comment
Open
1 task

x/incentives: investigate checkFinishDistribution #2031

mattverse opened this issue Jul 12, 2022 · 1 comment
Assignees

Comments

@mattverse
Copy link
Member

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
@ThanhNhann
Copy link
Contributor

ThanhNhann commented Oct 3, 2022

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

func (k Keeper) checkFinishDistribution(ctx sdk.Context, gauges []types.Gauge) {
for _, gauge := range gauges {
// filled epoch is increased in this step and we compare with +1
if !gauge.IsPerpetual && gauge.NumEpochsPaidOver <= gauge.FilledEpochs+1 {
if err := k.moveActiveGaugeToFinishedGauge(ctx, gauge); err != nil {
panic(err)
}
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Triage 🔍
Development

No branches or pull requests

4 participants
@ThanhNhann @mattverse @catShaark and others