-
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
Fix Gas Flag Usage + CLI Flag APIs #6685
Conversation
Codecov Report
@@ Coverage Diff @@
## master #6685 +/- ##
==========================================
- Coverage 58.36% 53.94% -4.43%
==========================================
Files 503 338 -165
Lines 30226 19456 -10770
==========================================
- Hits 17641 10495 -7146
+ Misses 11295 8239 -3056
+ Partials 1290 722 -568 |
@@ -52,13 +52,16 @@ func NewFactoryCLI(clientCtx client.Context, flagSet *pflag.FlagSet) Factory { | |||
gasAdj, _ := flagSet.GetFloat64(flags.FlagGasAdjustment) | |||
memo, _ := flagSet.GetString(flags.FlagMemo) | |||
|
|||
gasStr, _ := flagSet.GetString(flags.FlagGas) | |||
gasSetting, _ := flags.ParseGasSetting(gasStr) |
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.
gasSetting, _ := flags.ParseGasSetting(gasStr) | |
gasSetting, err := flags.ParseGasSetting(gasStr) | |
if err != nil { | |
panic(err) | |
} |
This is because ParseGasSetting
must never fail there, but if it does it must panic
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.
Ideally, we return an error here.
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.
Just left a comment on error checking. A long-overdue one, thanks!!
* Use new APIs * fix usage * fix usage of gas flag * tests: TestParseGasSetting
Description
flags.AddTxFlagsToCmd
andflags.AddQueryFlagsToCmd
in favor of poorly designed(Get|Post)Commands
.closes: #6545
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
docs/
) or specification (x/<module>/spec/
)godoc
comments.Unreleased
section inCHANGELOG.md
Files changed
in the Github PR explorerCodecov Report
in the comment section below once CI passes