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

feat: Add CLI for new gov proposal #11013

Merged
merged 16 commits into from
Jan 31, 2022
Merged

feat: Add CLI for new gov proposal #11013

merged 16 commits into from
Jan 31, 2022

Conversation

amaury1093
Copy link
Contributor

@amaury1093 amaury1093 commented Jan 24, 2022

Description

Closes: #10952

Depends on : #10490 for proposal metadata


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)

@amaury1093 amaury1093 changed the title feat: Add CLI for new proposal feat: Add CLI for new gov proposal Jan 24, 2022
x/gov/client/cli/tx.go Outdated Show resolved Hide resolved
@amaury1093 amaury1093 marked this pull request as ready for review January 26, 2022 12:46
Comment on lines +92 to +106
Where proposal.json contains:

{
// array of proto-JSON-encoded sdk.Msgs
"messages": [
{
"@type": "/cosmos.bank.v1beta1.MsgSend",
"from_address": "cosmos1...",
"to_address": "cosmos1...",
"amount":[{"denom": "stake","amount": "10"}]
}
],
"metadata: "4pIMOgIGx1vZGU=", // base64-encoded metadata
"deposit": "10stake"
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

LMK what you think about this JSON format for submitting a proposal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think that's preferable

Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

Is it necessary to support backwards compatibility via the CLI? We're changing the command name anyway so it already breaks users scripts. I also think most people submit proposals via JSON anyway so I don't think we need to keep around all the legacy flags

x/gov/client/cli/tx.go Outdated Show resolved Hide resolved
Comment on lines +92 to +106
Where proposal.json contains:

{
// array of proto-JSON-encoded sdk.Msgs
"messages": [
{
"@type": "/cosmos.bank.v1beta1.MsgSend",
"from_address": "cosmos1...",
"to_address": "cosmos1...",
"amount":[{"denom": "stake","amount": "10"}]
}
],
"metadata: "4pIMOgIGx1vZGU=", // base64-encoded metadata
"deposit": "10stake"
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I think that's preferable

@amaury1093
Copy link
Contributor Author

Is it necessary to support backwards compatibility via the CLI?

I have a slight preference for keeping submit-legacy-proposal. The current PR breaks user scripts as you say, but a s/submit-proposal/submit-legacy-proposal will fix those scripts.

If we only allowed the new Msg-based proposals, there will be some non-trivial changes to make for CLI users (aka converting their proposal JSONs or flags)

@cmwaters
Copy link
Contributor

Yeah you're right that they're non-trivial changes but my theory is that dev ops people, like all good programmers are inherently lazy, and I doubt any of them will change their scripts until v0.47 when we finally remove support and it breaks them.

@amaury1093
Copy link
Contributor Author

I agree with that observation. However, I'd argue that telling them the cmd is deprecated and will be removed in the next release, is a better UX than forcing them to do changes ASAP.

I also think we need a CLI (or some other tooling) to create proposal JSONs. Currently the only way is to write this JSON #11013 (comment) manually, which is error prone.

I wonder if @aaronc of @blushi have opinions here, maybe we should align this with group's create-proposal.

Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

Aside from our decision around how breaking we want this to be, the changes here LGTM

@blushi
Copy link
Contributor

blushi commented Jan 31, 2022

I wonder if @aaronc of @blushi have opinions here, maybe we should align this with group's create-proposal.

I would agree with this.

@amaury1093
Copy link
Contributor Author

I created #11070.

Anyways, I would prefer to tackle 11070 in a follow-up: this PR adds CLI functionality and tests, and #11070 deals with UX (and might also need to change proto Msg names). LMK if that works.

@blushi
Copy link
Contributor

blushi commented Jan 31, 2022

I created #11070.

Anyways, I would prefer to tackle 11070 in a follow-up: this PR adds CLI functionality and tests, and #11070 deals with UX (and might also need to change proto Msg names). LMK if that works.

Sounds good to me!

Copy link
Contributor

@atheeshp atheeshp left a comment

Choose a reason for hiding this comment

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

lgtm

@amaury1093 amaury1093 added the A:automerge Automatically merge PR once all prerequisites pass. label Jan 31, 2022
@amaury1093 amaury1093 merged commit 62d9790 into master Jan 31, 2022
@amaury1093 amaury1093 deleted the am/10952-gov-cli branch January 31, 2022 21:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:CLI C:x/auth C:x/authz C:x/feegrant C:x/gov
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add CLI command to submit new Gov proposals, using Msgs
4 participants