-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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(autocli): fix simapp enhancing #15906
Conversation
@@ -245,8 +245,6 @@ func queryCommand() *cobra.Command { | |||
authcmd.QueryTxCmd(), | |||
) | |||
|
|||
simapp.ModuleBasics.AddQueryCommands(cmd) |
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 is not necessary as autocli will enrich the commands that are not present
// if we have an existing command skip adding one here | ||
if cmd.HasSubCommands() { | ||
if _, _, err := cmd.Find([]string{moduleName}); err == nil { |
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 was always returning true for simapp. We already had a helper that was working.
if msgCmd := findSubCommand(rootCmd, "tx"); msgCmd != nil { | ||
if err := builder.enhanceCommandCommon(msgCmd, moduleOptions, customQueryCmds, enhanceMsg); err != nil { |
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.
So here it was passing the custom query commands, which is incorrect.
x/nft/module/autocli.go
Outdated
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.
Without this file, the command is not generated.
Still getting failure when running app err="client context not set"
for all generated autocli apps.
Investigating the issue first. If this file is always needed then we need to update the docs as well.
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 is done here: 1f01c04
I still have to dig the reason it was returning an error before, as the behavior of the commit above makes sense to me.
msgCmd := topLevelCmd("tx", "Transaction subcommands") | ||
enhanceMsg := func(cmd *cobra.Command, modOpts *autocliv1.ModuleOptions, moduleName string) error { | ||
txCmdDesc := modOpts.Tx |
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 was duplicated.
queryCmd := topLevelCmd("query", "Querying subcommands") | ||
queryCmd.Aliases = []string{"q"} | ||
|
||
enhanceMsg := func(cmd *cobra.Command, modOpts *autocliv1.ModuleOptions, moduleName string) error { | ||
txQueryDesc := modOpts.Query |
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 was duplicated.
This comment has been minimized.
This comment has been minimized.
50abaac
to
03a1c95
Compare
@@ -24,18 +27,20 @@ func (a addressStringType) NewValue(ctx context.Context, b *Builder) Value { | |||
if resp == nil || resp.Config == nil { | |||
panic("bech32 account address prefix is not set") | |||
} | |||
b.AddressPrefix = resp.Config.Bech32AccountAddressPrefix | |||
|
|||
b.AddressCodec = addresscodec.NewBech32Codec(resp.Config.Bech32AccountAddressPrefix) |
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.
We shouldn't call grpc every time to get the bech32 prefix. This should be done by hubl during unit and update and then cached
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.
I agree, do you want me to do that here or in a follow-up? This PR does not touch hubl's code.
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.
In a follow up
* solved lint issues * feat(x/tx): API improvements (cosmos#15871) * refactor(baseapp): set vote info to latest votes (cosmos#15930) * refactor(staking, slashing, signing, misc): remove aliases from types/math.go (cosmos#15902) * fix(autocli): fix simapp enhancing (cosmos#15906) * fix lint on armor.go * ran make lint-fix --------- Co-authored-by: Matt Kocubinski <[email protected]> Co-authored-by: Marko <[email protected]> Co-authored-by: samricotta <[email protected]> Co-authored-by: Julien Robert <[email protected]>
Description
Discovered a bug in AutoCLI that it does not enrich the command when the CLI isn't defined, this PR will fix this as well.
Add client breaking changelogActually, we can make it non-breaking by tweakingautocli.go
autocli.go
file should be, add boilerplate for changelog and readme)I've tested the changes with simapp and hubl and it works.
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...
!
to the type prefix if API or client breaking changeCHANGELOG.md
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...
!
in the type prefix if API or client breaking change