-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
R4R: Address gov cli ux issues and add additional input validation for better errors #2938
Conversation
cc @sunnya97 |
Codecov Report
@@ Coverage Diff @@
## develop #2938 +/- ##
===========================================
- Coverage 56.19% 55.72% -0.47%
===========================================
Files 120 120
Lines 8383 8468 +85
===========================================
+ Hits 4711 4719 +8
- Misses 3350 3427 +77
Partials 322 322 |
@jack rebase on top of develop please - the test failures will eventually go |
8ccc88c
to
67ea707
Compare
amount, err := sdk.ParseCoins(proposal.Deposit) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
// ensure account has enough coins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't wrong, but it's a weird way to write this logic - we shouldn't be doing this in CLI commands generally, we should be simulating transactions and displaying the error to the user before broadcasting them (if the simulation failed).
If we simulate a submit-proposal transaction with not enough sender balance, it should fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. I copied this pattern from the x/auth/client/cli/sign.go
. Is there a place where this pattern is shown? The code in this PR fixes some really bad errors and UX in the governance and I works well in the current form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Discussed, fine for now, let's fix the root cause though (separately) - #2953
if err != nil { | ||
return err | ||
} | ||
|
||
msg := gov.NewMsgDeposit(depositorAddr, proposalID, amount) | ||
// ensure account has enough coins |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above (we should simulate instead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above
Co-Authored-By: jackzampolin <jack.zampolin@gmail.com>
Co-Authored-By: jackzampolin <jack.zampolin@gmail.com>
Co-Authored-By: jackzampolin <jack.zampolin@gmail.com>
Co-Authored-By: jackzampolin <jack.zampolin@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these new commands look all very confusing (see comments). IMHO the even worsen the current implementation's UX. Also there's no issue with a proposal that's been discussed and accepted.
Here are a couple of issues around the UX on the gov CLI addressed by this PR:
And here is one endorsing the use of positional arguments (which links to one about required flags): If there are one or two required arguments I don't think its confusing (especially if the documentation is accurate and helpful, which the help text is). It may be confusing the first time the user uses the tool, but it's a HUGE improvement for anyone who uses the tool more than once (the users we care about). It also makes commands much more realistic to type in. Also we have WAY too many flags in the current CLI and this eliminates some of them. |
I think docs require update |
Thanks for the clarification, you forgot to mention those on the description and updating
Indeed the docs are accurate, but switching to args just because we have too many flags is not a great solution imo. If we want it to be descriptive and objective about the args we should stick with flags. Users can use shorthands for flags if they are tired of writing the full name |
Because 1/2 of the commands changed here required 1 flag: Also may of these "required" flags we not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK. Minor comments to keep consistency with the cmds descriptions
gaiacli query gov tally <proposal_id> | ||
``` | ||
|
||
#### Query governance parameters |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
++ thanks !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
d'accord!
Co-Authored-By: jackzampolin <jack.zampolin@gmail.com>
Co-Authored-By: jackzampolin <jack.zampolin@gmail.com>
…ter errors (#2938) * Fix governance cli ux issues and add additional transaction validation
Targeted PR against correct branch (see CONTRIBUTING.md)
Linked to github-issue with discussion and accepted design OR link to spec that describes this work.
Wrote tests
Updated relevant documentation (
docs/
)Added entries in
PENDING.md
with issue #rereviewed
Files changed
in the github PR explorer