diff --git a/client/v2/autocli/app.go b/client/v2/autocli/app.go index 6fbb5952ea..47d7a388df 100644 --- a/client/v2/autocli/app.go +++ b/client/v2/autocli/app.go @@ -62,10 +62,18 @@ type AppOptions struct { // rootCmd := initRootCmd() // err = autoCliOpts.EnhanceRootCommand(rootCmd) func (appOptions AppOptions) EnhanceRootCommand(rootCmd *cobra.Command) error { - mergedFiles, err := proto.MergedRegistry() + var ( + mergedFiles flag.FileResolver + err error + ) + + mergedFiles, err = proto.MergedRegistry() if err != nil { - return err + // we can safely ignore this error, as this should have been called somewhere earlier + // in the app's lifecycle. + mergedFiles = appOptions.ClientCtx.InterfaceRegistry } + builder := &Builder{ Builder: flag.Builder{ TypeResolver: protoregistry.GlobalTypes, diff --git a/client/v2/autocli/flag/builder.go b/client/v2/autocli/flag/builder.go index 5a03914a72..f1216150bd 100644 --- a/client/v2/autocli/flag/builder.go +++ b/client/v2/autocli/flag/builder.go @@ -32,17 +32,21 @@ const ( DecScalarType = "cosmos.Dec" ) +// FileResolver specifies how protobuf file descriptors will be resolved. +type FileResolver interface { + protodesc.Resolver + RangeFiles(func(protoreflect.FileDescriptor) bool) +} + // Builder manages options for building pflag flags for protobuf messages. type Builder struct { - // TypeResolver specifies how protobuf types will be resolved. If it is - // nil protoregistry.GlobalTypes will be used. + // TypeResolver specifies how protobuf types will be resolved. TypeResolver interface { protoregistry.MessageTypeResolver protoregistry.ExtensionTypeResolver } - // FileResolver specifies how protobuf file descriptors will be resolved. If it is - // nil protoregistry.GlobalFiles will be used. + // FileResolver specifies how protobuf file descriptors will be resolved. FileResolver interface { protodesc.Resolver RangeFiles(func(protoreflect.FileDescriptor) bool) @@ -300,7 +304,7 @@ func (b *Builder) addFlattenFieldBindingToArgs(ctx *context.Context, path string func (b *Builder) addFieldBindingToArgs(ctx *context.Context, messageBinder *MessageBinder, name protoreflect.Name, fields protoreflect.FieldDescriptors) (fieldBinding, error) { field := fields.ByName(name) if field == nil { - return fieldBinding{}, fmt.Errorf("can't find field %s", name) // TODO: it will improve error if msg.FullName() was included.` + return fieldBinding{}, fmt.Errorf("can't find field %s in %s", name, messageBinder.messageType.Descriptor().FullName()) } _, hasValue, err := b.addFieldFlag( diff --git a/x/crisis/autocli.go b/x/crisis/autocli.go index 99586c26b2..d8926f4b86 100644 --- a/x/crisis/autocli.go +++ b/x/crisis/autocli.go @@ -1,11 +1,8 @@ package crisis import ( - "fmt" - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" crisisv1beta1 "cosmossdk.io/api/cosmos/crisis/v1beta1" - "github.com/cosmos/cosmos-sdk/version" ) // AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. @@ -24,12 +21,8 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, { - RpcMethod: "UpdateParams", - Use: "update-params-proposal [params]", - Short: "Submit a proposal to update crisis module params. Note: the entire params must be provided.", - Example: fmt.Sprintf(`%s tx crisis update-params-proposal '{ "constant_fee": {"denom": "stake", "amount": "1000"} }'`, version.AppName), - PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, - GovProposal: true, + RpcMethod: "UpdateParams", + Skip: true, // Crisis is deprecated. }, }, }, diff --git a/x/gov/client/cli/util.go b/x/gov/client/cli/util.go index 74b48f4625..5153dafd97 100644 --- a/x/gov/client/cli/util.go +++ b/x/gov/client/cli/util.go @@ -131,7 +131,7 @@ func AddGovPropFlagsToCmd(cmd *cobra.Command) { cmd.Flags().String(FlagMetadata, "", "The metadata to include with the governance proposal") cmd.Flags().String(FlagTitle, "", "The title to put on the governance proposal") cmd.Flags().String(FlagSummary, "", "The summary to include with the governance proposal") - cmd.Flags().Bool(FlagExpedited, false, "Whether to expedite the governance proposal") + // cmd.Flags().Bool(FlagExpedited, false, "Whether to expedite the governance proposal") // cannot be enabled because of IBC redefining this flag in `upgrade-channels` command. } // ReadGovPropCmdFlags parses a MsgSubmitProposal from the provided context and flags. @@ -167,10 +167,10 @@ func ReadGovPropCmdFlags(proposer string, flagSet *pflag.FlagSet) (*govv1.MsgSub return nil, fmt.Errorf("could not read summary: %w", err) } - rv.Expedited, err = flagSet.GetBool(FlagExpedited) - if err != nil { - return nil, fmt.Errorf("could not read expedited: %w", err) - } + // rv.Expedited, err = flagSet.GetBool(FlagExpedited) + // if err != nil { + // return nil, fmt.Errorf("could not read expedited: %w", err) + // } rv.Proposer = proposer