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

fix: Make a denom of --min-self-delegation CLI flag required #9548

Closed

Conversation

youngjoon-lee
Copy link

@youngjoon-lee youngjoon-lee commented Jun 19, 2021

Description

Closes: #9386

As we discussed, I've put a denom to the --min-self-delegation CLI flag.
But, I didn't change the msg types (MsgCreateValidator and so on) which contain MinSelfDelegation as sdk.Int in order not to break the API backward compatibility. If you think that msg types also need to be changed, please let me know :)


Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@youngjoon-lee youngjoon-lee marked this pull request as draft June 19, 2021 14:08
@youngjoon-lee youngjoon-lee marked this pull request as ready for review June 19, 2021 14:09
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution. Can you please format the changes?

@@ -25,7 +25,7 @@ var (
defaultCommissionRate = "0.1"
defaultCommissionMaxRate = "0.2"
defaultCommissionMaxChangeRate = "0.01"
defaultMinSelfDelegation = "1"
defaultMinSelfDelegation = "1" + sdk.DefaultBondDenom
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going to make stake the default flag which I don't think we should do.

Copy link
Author

@youngjoon-lee youngjoon-lee Jun 21, 2021

Choose a reason for hiding this comment

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

Yeah. Make sense.
But, I've referred to the defaultAmount which contains sdk.DefaultBondDenom as below:
https://github.com/youngjoon-lee/cosmos-sdk/blob/af995cd5ee5c30dccbb989cd6892e142d5dde818/x/staking/client/cli/tx.go#L24

Because I made a denom required, I think the defaultMinSelfDelegation has to have a denom.
Of course, I added a logic to check whether the denom is the same as the expected one, or not.
What do you think about this strategy?

Copy link
Author

@youngjoon-lee youngjoon-lee Jun 21, 2021

Choose a reason for hiding this comment

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

Also, I thought this is a uncompleted improvement, as long as we change MsgCreateValidator to contains MinSelfDelegation as sdk.Coin (not sdk.Int): https://github.com/youngjoon-lee/cosmos-sdk/blob/09f9a5573e4132fbedfaab6d948df1cc93e6e896/x/staking/types/tx.pb.go#L43

While I wrote this PR, I've felt that the original author chose sdk.Int rather than sdk.Coin because he wanted to define MinSelfDelegation as "the minimum value regardless of what its denom is".
If so, I think it's okay to close this PR without merging (It would be better to make consistency between MsgCreateValidator and CLI options).

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah honestly, I don't think having a denom in the CLI UX will add that much benefit to be honest. I'm not sure what others think.

Copy link
Author

@youngjoon-lee youngjoon-lee Jun 21, 2021

Choose a reason for hiding this comment

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

Yeah. As the Gaia document has been updated: cosmos/gaia#867, I think it's clear that the unit of --min-self-delegation is stake or uatom.

So, I'm closing this PR. Please feel free to open this PR if you think it's necessary. @ryanchristo

x/staking/client/cli/tx.go Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unit of min-self-delegation
2 participants