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

feature: implement ante handle for min commission #1698

Closed

Conversation

MiB-Intern
Copy link

@MiB-Intern MiB-Intern commented Aug 26, 2022

If proposal 76 passes, validator min commission should be enforced onchain.

Right now MsgEditValidator and MsgCreateValidator allow any commission value, we should check that c.Rate is above the amount decided by governance.

--

Need to add something like this to the next upgrade handler

// force an update of validator min commission
validators := app.StakingKeeper.GetAllValidators(ctx)
		
minCommissionRate := sdk.NewDecWithPrec(5, 2)
for _, v := range validators {
    if v.Commission.Rate.LT(minCommissionRate) {
        if v.Commission.MaxRate.LT(minCommissionRate) {
            v.Commission.MaxRate = minCommissionRate
        }

    v.Commission.Rate = minCommissionRate
    v.Commission.UpdateTime = ctx.BlockHeader().Time

    // call the before-modification hook since we're about to update the commission
    app.StakingKeeper.BeforeValidatorModified(ctx, v.GetOperator())

    app.StakingKeeper.SetValidator(ctx, v)
    }
}

Closes #1697

Original code by giansalex, Osmosis and Juno teams

@faddat
Copy link
Contributor

faddat commented Sep 1, 2022

Thanks very much!

I think that we should merge this, even if 76 doesn't pass, but with the parameters set to zero.

minCommissionRate := sdk.NewDecWithPrec(0, 2)

This would give gaia more flexibility in the future.

@mmulji-ic
Copy link
Contributor

Thanks very much!

I think that we should merge this, even if 76 doesn't pass, but with the parameters set to zero.

minCommissionRate := sdk.NewDecWithPrec(0, 2)

This would give gaia more flexibility in the future.

@okwme any opinion?

@stale
Copy link

stale bot commented Nov 12, 2022

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 12, 2022
@okwme
Copy link
Contributor

okwme commented Nov 17, 2022

Thanks for the contribution @MiB-Intern !
I'm going to close it for now in light of current priorities but we can always re-open if the issue goes to vote again.

@okwme okwme closed this Nov 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Minimum Commission for proposal 76
4 participants