Skip to content

feat(v4/upgrade): add migration to fix validators commission to 5%#300

Open
giunatale wants to merge 4 commits intomainfrom
giunatale/commission-migration
Open

feat(v4/upgrade): add migration to fix validators commission to 5%#300
giunatale wants to merge 4 commits intomainfrom
giunatale/commission-migration

Conversation

@giunatale
Copy link
Collaborator

Closes #288

if err != nil {
return err
}
for _, validator := range validators {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This migration sets every validator's commission rate to 5%, but leaves MaxRate unchanged. If any existing validator has max_rate < 0.05, the upgrade writes an invalid commission config (rate > max_rate). Can we either fail fast on that case or migrate the validator-level commission bounds together with the rate?

Suggested change
for _, validator := range validators {
for _, validator := range validators {
// leaving MaxRate and MaxChangeRate unchanged as validator-defined values.
validator.Commission.Rate = fivePercent

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't the commission change fail? I don't understand

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok I see now, I can upgrade the maxRate if is less than 5%, but only in that case

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch Danilo, this makes me realize that if an MsgUpdateParams passes and there is changes in the commission rate range, this should affect the validators as well, just like in this migration.

WDYT? (not asking to do this change here, but if you're agree I'll create a separate issue)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense to me yes

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK created the issue there atomone-hub/cosmos-sdk#75

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add migration to set staking param MaxCommission to 5%

4 participants