gaia
gaia copied to clipboard
feature: implement ante handle for min commission
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
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.
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?
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.
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.