From 9c3386ffd2451158c40c6cb77c9816d78e534df8 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Wed, 15 Nov 2023 12:16:25 +0100 Subject: [PATCH] feat(client/v2): support gov proposals (#18461) --- client/prompt_validation.go | 2 +- client/v2/CHANGELOG.md | 4 + client/v2/README.md | 7 +- client/v2/autocli/flag/builder.go | 2 +- client/v2/autocli/msg.go | 78 ++++++++++++++++++-- client/v2/go.mod | 10 ++- client/v2/go.sum | 13 +++- client/v2/internal/flags/flags.go | 7 ++ client/v2/internal/prompt/validation.go | 36 +++++++++ client/v2/internal/prompt/validation_test.go | 30 ++++++++ go.mod | 2 +- go.sum | 4 +- simapp/go.mod | 4 +- tests/go.mod | 4 +- tests/starship/tests/go.mod | 4 +- x/accounts/go.mod | 2 +- x/auth/autocli.go | 8 +- x/auth/go.mod | 2 +- x/auth/go.sum | 4 +- x/authz/go.mod | 2 +- x/bank/autocli.go | 22 +++++- x/bank/go.mod | 2 +- x/bank/go.sum | 4 +- x/circuit/go.mod | 2 +- x/circuit/go.sum | 4 +- x/consensus/autocli.go | 14 +++- x/crisis/autocli.go | 11 ++- x/distribution/autocli.go | 16 ++-- x/distribution/go.mod | 2 +- x/distribution/go.sum | 4 +- x/evidence/go.mod | 2 +- x/evidence/go.sum | 4 +- x/feegrant/go.mod | 2 +- x/feegrant/go.sum | 4 +- x/gov/autocli.go | 9 ++- x/gov/client/cli/prompt.go | 2 + x/gov/client/cli/tx.go | 2 + x/gov/client/cli/util.go | 21 +++++- x/gov/go.mod | 2 +- x/group/go.mod | 2 +- x/group/go.sum | 4 +- x/mint/autocli.go | 12 ++- x/mint/go.mod | 2 +- x/mint/go.sum | 4 +- x/nft/go.mod | 2 +- x/nft/go.sum | 4 +- x/params/go.mod | 2 +- x/params/go.sum | 4 +- x/protocolpool/go.mod | 2 +- x/protocolpool/go.sum | 4 +- x/slashing/autocli.go | 9 ++- x/slashing/go.mod | 2 +- x/slashing/go.sum | 4 +- x/staking/autocli.go | 9 ++- x/staking/go.mod | 2 +- x/staking/go.sum | 4 +- x/upgrade/autocli.go | 11 ++- x/upgrade/client/cli/tx.go | 56 +------------- x/upgrade/go.mod | 2 +- x/upgrade/go.sum | 4 +- 60 files changed, 346 insertions(+), 153 deletions(-) create mode 100644 client/v2/internal/prompt/validation.go create mode 100644 client/v2/internal/prompt/validation_test.go diff --git a/client/prompt_validation.go b/client/prompt_validation.go index d12a0a1322..288a1c95ef 100644 --- a/client/prompt_validation.go +++ b/client/prompt_validation.go @@ -47,7 +47,7 @@ func ValidatePromptAddress(input string) error { // TODO(@julienrbrt) remove and return fmt.Errorf("invalid address: %w", err) } -// ValidatePromptYesNo validates that the input is valid sdk.COins +// ValidatePromptCoins validates that the input contains valid sdk.Coins func ValidatePromptCoins(input string) error { if _, err := sdk.ParseCoinsNormalized(input); err != nil { return fmt.Errorf("invalid coins: %w", err) diff --git a/client/v2/CHANGELOG.md b/client/v2/CHANGELOG.md index 9b121c9007..2287e6bd07 100644 --- a/client/v2/CHANGELOG.md +++ b/client/v2/CHANGELOG.md @@ -38,6 +38,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ +### Features + +* [#18461](https://github.com/cosmos/cosmos-sdk/pull/18461) Support governance proposals. + ### API Breaking Changes * [#17709](https://github.com/cosmos/cosmos-sdk/pull/17709) Address codecs have been removed from `autocli.AppOptions` and `flag.Builder`. Instead client/v2 uses the address codecs present in the context (introduced in [#17503](https://github.com/cosmos/cosmos-sdk/pull/17503)). diff --git a/client/v2/README.md b/client/v2/README.md index e5458ea9a9..dee206d93b 100644 --- a/client/v2/README.md +++ b/client/v2/README.md @@ -121,7 +121,7 @@ This field is automatically filled when using the `--from` flag or defining the AutoCLI currently supports only one signer per transaction. ::: -## Module Wiring & Customization +## Module wiring & Customization The `AutoCLIOptions()` method on your module allows to specify custom commands, sub-commands or flags for each service, as it was a `cobra.Command` instance, within the `RpcCommandOptions` struct. Defining such options will customize the behavior of the `autocli` command generation, which by default generates a command for each method in your gRPC service. @@ -137,6 +137,11 @@ The `AutoCLIOptions()` method on your module allows to specify custom commands, } ``` +:::tip +AutoCLI can create a gov proposal of any tx by simply setting the `GovProposal` field to `true` in the `autocli.RpcCommandOptions` struct. +Users can however use the `--no-proposal` flag to disable the proposal creation (which is useful if the authority isn't the gov module on a chain). +::: + ### Specifying Subcommands By default, `autocli` generates a command for each method in your gRPC service. However, you can specify subcommands to group related commands together. To specify subcommands, use the `autocliv1.ServiceCommandDescriptor` struct. diff --git a/client/v2/autocli/flag/builder.go b/client/v2/autocli/flag/builder.go index 45f030eaad..da3f434bc0 100644 --- a/client/v2/autocli/flag/builder.go +++ b/client/v2/autocli/flag/builder.go @@ -214,10 +214,10 @@ func (b *Builder) addMessageFlags(ctx context.Context, flagSet *pflag.FlagSet, m flagOpts := commandOptions.FlagOptions[string(field.Name())] name, hasValue, err := b.addFieldFlag(ctx, flagSet, field, flagOpts, options) - flagOptsByFlagName[name] = flagOpts if err != nil { return nil, err } + flagOptsByFlagName[name] = flagOpts messageBinder.flagBindings = append(messageBinder.flagBindings, fieldBinding{ hasValue: hasValue, diff --git a/client/v2/autocli/msg.go b/client/v2/autocli/msg.go index 849513be98..c863dba4e1 100644 --- a/client/v2/autocli/msg.go +++ b/client/v2/autocli/msg.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/cockroachdb/errors" + gogoproto "github.com/cosmos/gogoproto/proto" "github.com/spf13/cobra" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/reflect/protoreflect" @@ -12,10 +13,18 @@ import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" "cosmossdk.io/client/v2/autocli/flag" + "cosmossdk.io/client/v2/internal/flags" "cosmossdk.io/client/v2/internal/util" + addresscodec "cosmossdk.io/core/address" authtx "cosmossdk.io/x/auth/tx" authtxconfig "cosmossdk.io/x/auth/tx/config" + // the following will be extracted to a separate module + // https://github.com/cosmos/cosmos-sdk/issues/14403 + authtypes "cosmossdk.io/x/auth/types" + govcli "cosmossdk.io/x/gov/client/cli" + govtypes "cosmossdk.io/x/gov/types" + "github.com/cosmos/cosmos-sdk/client" clienttx "github.com/cosmos/cosmos-sdk/client/tx" "github.com/cosmos/cosmos-sdk/codec" @@ -111,7 +120,7 @@ func (b *Builder) AddMsgServiceCommands(cmd *cobra.Command, cmdDescriptor *autoc // BuildMsgMethodCommand returns a command that outputs the JSON representation of the message. func (b *Builder) BuildMsgMethodCommand(descriptor protoreflect.MethodDescriptor, options *autocliv1.RpcCommandOptions) (*cobra.Command, error) { - cmd, err := b.buildMethodCommandCommon(descriptor, options, func(cmd *cobra.Command, input protoreflect.Message) error { + execFunc := func(cmd *cobra.Command, input protoreflect.Message) error { cmd.SetContext(context.WithValue(context.Background(), client.ClientContextKey, &b.ClientCtx)) clientCtx, err := client.GetClientTxContext(cmd) @@ -140,11 +149,17 @@ func (b *Builder) BuildMsgMethodCommand(descriptor protoreflect.MethodDescriptor clientCtx = clientCtx.WithTxConfig(txConfig) } - // set signer to signer field if empty fd := input.Descriptor().Fields().ByName(protoreflect.Name(flag.GetSignerFieldName(input.Descriptor()))) - if addr := input.Get(fd).String(); addr == "" { - addressCodec := b.Builder.AddressCodec + addressCodec := b.Builder.AddressCodec + // handle gov proposals commands + skipProposal, _ := cmd.Flags().GetBool(flags.FlagNoProposal) + if options.GovProposal && !skipProposal { + return b.handleGovProposal(options, cmd, input, clientCtx, addressCodec, fd) + } + + // set signer to signer field if empty + if addr := input.Get(fd).String(); addr == "" { scalarType, ok := flag.GetScalarType(fd) if ok { // override address codec if validator or consensus address @@ -172,7 +187,12 @@ func (b *Builder) BuildMsgMethodCommand(descriptor protoreflect.MethodDescriptor proto.Merge(msg, input.Interface()) return clienttx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }) + } + + cmd, err := b.buildMethodCommandCommon(descriptor, options, execFunc) + if err != nil { + return nil, err + } if b.AddTxConnFlags != nil { b.AddTxConnFlags(cmd) @@ -183,5 +203,51 @@ func (b *Builder) BuildMsgMethodCommand(descriptor protoreflect.MethodDescriptor cmd.SilenceUsage = true } - return cmd, err + // set gov proposal flags if command is a gov proposal + if options.GovProposal { + govcli.AddGovPropFlagsToCmd(cmd) + cmd.Flags().Bool(flags.FlagNoProposal, false, "Skip gov proposal and submit a normal transaction") + } + + return cmd, nil +} + +// handleGovProposal sets the authority field of the message to the gov module address and creates a gov proposal. +func (b *Builder) handleGovProposal( + options *autocliv1.RpcCommandOptions, + cmd *cobra.Command, + input protoreflect.Message, + clientCtx client.Context, + addressCodec addresscodec.Codec, + fd protoreflect.FieldDescriptor, +) error { + govAuthority := authtypes.NewModuleAddress(govtypes.ModuleName) + authority, err := addressCodec.BytesToString(govAuthority.Bytes()) + if err != nil { + return fmt.Errorf("failed to convert gov authority: %w", err) + } + input.Set(fd, protoreflect.ValueOfString(authority)) + + signerFromFlag := clientCtx.GetFromAddress() + signer, err := addressCodec.BytesToString(signerFromFlag.Bytes()) + if err != nil { + return fmt.Errorf("failed to set signer on message, got %q: %w", signerFromFlag, err) + } + + proposal, err := govcli.ReadGovPropCmdFlags(signer, cmd.Flags()) + if err != nil { + return err + } + + // AutoCLI uses protov2 messages, while the SDK only supports proto v1 messages. + // Here we use dynamicpb, to create a proto v1 compatible message. + // The SDK codec will handle protov2 -> protov1 (marshal) + msg := dynamicpb.NewMessage(input.Descriptor()) + proto.Merge(msg, input.Interface()) + + if err := proposal.SetMsgs([]gogoproto.Message{msg}); err != nil { + return fmt.Errorf("failed to set msg in proposal %w", err) + } + + return clienttx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposal) } diff --git a/client/v2/go.mod b/client/v2/go.mod index ceb874e3d2..c949eb9dff 100644 --- a/client/v2/go.mod +++ b/client/v2/go.mod @@ -3,14 +3,17 @@ module cosmossdk.io/client/v2 go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 + cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a cosmossdk.io/x/tx v0.12.0 + github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/errors v1.11.1 github.com/cosmos/cosmos-proto v1.0.0-beta.3 github.com/cosmos/cosmos-sdk v0.51.0 + github.com/manifoldco/promptui v0.9.0 // indirect github.com/spf13/cobra v1.8.0 github.com/spf13/pflag v1.0.5 google.golang.org/grpc v1.59.0 @@ -47,7 +50,7 @@ require ( github.com/cosmos/cosmos-db v1.0.0 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/gogoproto v1.4.11 // indirect + github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/iavl v1.0.0 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect @@ -132,7 +135,7 @@ require ( github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect github.com/spf13/viper v1.17.0 // indirect - github.com/stretchr/testify v1.8.4 // indirect + github.com/stretchr/testify v1.8.4 github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect @@ -163,6 +166,7 @@ replace ( cosmossdk.io/x/auth => ./../../x/auth cosmossdk.io/x/bank => ./../../x/bank cosmossdk.io/x/distribution => ./../../x/distribution + cosmossdk.io/x/gov => ./../../x/gov cosmossdk.io/x/mint => ./../../x/mint cosmossdk.io/x/protocolpool => ./../../x/protocolpool cosmossdk.io/x/slashing => ./../../x/slashing diff --git a/client/v2/go.sum b/client/v2/go.sum index 47b09d4ae4..4a1e0d1601 100644 --- a/client/v2/go.sum +++ b/client/v2/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= @@ -128,8 +128,14 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.1 h1:XHDu3E6q+gdHgsdTPH6ImJMIp436vR6MPtH8gP05QzM= +github.com/chzyer/logex v1.2.1/go.mod h1:JLbx6lG2kDbNRFnfkgvh4eRJRPX1QCoOIWomwysCBrQ= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.1 h1:upd/6fQk4src78LMRzh5vItIt361/o4uq553V8B5sGI= +github.com/chzyer/readline v1.5.1/go.mod h1:Eh+b79XXUwfKfcPLepksvw2tcLE/Ct21YObkaSkeBlk= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v1.0.0 h1:p3BQDXSxOhOG0P9z6/hGnII4LGiEPOYBhs8asl/fC04= +github.com/chzyer/test v1.0.0/go.mod h1:2JlltgoNkt4TW/z9V/IzDdFaMTM2JPIi26O1pF38GC8= github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6Dob7S7YxXgwXpfOuvO54S+tGdZdw9fuRZt25Ag= github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= @@ -529,6 +535,8 @@ github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0Q github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= +github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= +github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= @@ -1008,6 +1016,7 @@ golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220315194320-039c03cc5b86/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= diff --git a/client/v2/internal/flags/flags.go b/client/v2/internal/flags/flags.go index cd50a96be8..d06cef708c 100644 --- a/client/v2/internal/flags/flags.go +++ b/client/v2/internal/flags/flags.go @@ -10,6 +10,13 @@ const ( // FlagNoIndent is the flag to not indent the output. FlagNoIndent = "no-indent" + + // FlagNoPrompt is the flag to not use a prompt for commands. + FlagNoPrompt = "no-prompt" + + // FlagNoProposal is the flag convert a gov proposal command into a normal command. + // This is used to allow user of chains with custom authority to not use gov submit proposals for usual proposal commands. + FlagNoProposal = "no-proposal" ) // List of supported output formats diff --git a/client/v2/internal/prompt/validation.go b/client/v2/internal/prompt/validation.go new file mode 100644 index 0000000000..8a6e5a2d33 --- /dev/null +++ b/client/v2/internal/prompt/validation.go @@ -0,0 +1,36 @@ +package prompt + +import ( + "fmt" + "net/url" + + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// ValidatePromptNotEmpty validates that the input is not empty. +func ValidatePromptNotEmpty(input string) error { + if input == "" { + return fmt.Errorf("input cannot be empty") + } + + return nil +} + +// ValidatePromptURL validates that the input is a valid URL. +func ValidatePromptURL(input string) error { + _, err := url.ParseRequestURI(input) + if err != nil { + return fmt.Errorf("invalid URL: %w", err) + } + + return nil +} + +// ValidatePromptCoins validates that the input contains valid sdk.Coins +func ValidatePromptCoins(input string) error { + if _, err := sdk.ParseCoinsNormalized(input); err != nil { + return fmt.Errorf("invalid coins: %w", err) + } + + return nil +} diff --git a/client/v2/internal/prompt/validation_test.go b/client/v2/internal/prompt/validation_test.go new file mode 100644 index 0000000000..86e4ba4ab4 --- /dev/null +++ b/client/v2/internal/prompt/validation_test.go @@ -0,0 +1,30 @@ +package prompt_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "cosmossdk.io/client/v2/internal/prompt" +) + +func TestValidatePromptNotEmpty(t *testing.T) { + require := require.New(t) + + require.NoError(prompt.ValidatePromptNotEmpty("foo")) + require.ErrorContains(prompt.ValidatePromptNotEmpty(""), "input cannot be empty") +} + +func TestValidatePromptURL(t *testing.T) { + require := require.New(t) + + require.NoError(prompt.ValidatePromptURL("https://example.com")) + require.ErrorContains(prompt.ValidatePromptURL("foo"), "invalid URL") +} + +func TestValidatePromptCoins(t *testing.T) { + require := require.New(t) + + require.NoError(prompt.ValidatePromptCoins("100stake")) + require.ErrorContains(prompt.ValidatePromptCoins("foo"), "invalid coins") +} diff --git a/go.mod b/go.mod index 8dc3b79060..8784d48e95 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ go 1.21 module github.com/cosmos/cosmos-sdk require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/go.sum b/go.sum index 15420a9c07..0c905de348 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/simapp/go.mod b/simapp/go.mod index 27401268b9..f3141d099d 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/simapp go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 @@ -40,7 +40,7 @@ require ( cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/distribution v0.0.0-20230925135524-a1bc045b3190 - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 + cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a cosmossdk.io/x/group v0.0.0-00010101000000-000000000000 cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000 cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000 diff --git a/tests/go.mod b/tests/go.mod index 7024b302d4..4e5c4cfcb9 100644 --- a/tests/go.mod +++ b/tests/go.mod @@ -3,7 +3,7 @@ module github.com/cosmos/cosmos-sdk/tests go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 @@ -38,7 +38,7 @@ require ( cosmossdk.io/x/authz v0.0.0-00010101000000-000000000000 cosmossdk.io/x/bank v0.0.0-00010101000000-000000000000 cosmossdk.io/x/distribution v0.0.0-20230925135524-a1bc045b3190 - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 + cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a cosmossdk.io/x/group v0.0.0-00010101000000-000000000000 cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000 cosmossdk.io/x/slashing v0.0.0-00010101000000-000000000000 diff --git a/tests/starship/tests/go.mod b/tests/starship/tests/go.mod index f1e64ce12d..6a1d7e5936 100644 --- a/tests/starship/tests/go.mod +++ b/tests/starship/tests/go.mod @@ -52,7 +52,7 @@ require ( cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/iam v1.1.3 // indirect cloud.google.com/go/storage v1.33.0 // indirect - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 // indirect + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a // indirect cosmossdk.io/client/v2 v2.0.0-20230630094428-02b760776860 // indirect cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/core v0.12.0 // indirect @@ -65,7 +65,7 @@ require ( cosmossdk.io/x/distribution v0.0.0-20230925135524-a1bc045b3190 // indirect cosmossdk.io/x/evidence v0.0.0-20230613133644-0a778132a60f // indirect cosmossdk.io/x/feegrant v0.0.0-20230613133644-0a778132a60f // indirect - cosmossdk.io/x/gov v0.0.0-20230925135524-a1bc045b3190 // indirect + cosmossdk.io/x/gov v0.0.0-20231113122742-912390d5fc4a // indirect cosmossdk.io/x/group v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/mint v0.0.0-00010101000000-000000000000 // indirect cosmossdk.io/x/nft v0.0.0-20230613133644-0a778132a60f // indirect diff --git a/x/accounts/go.mod b/x/accounts/go.mod index a16cabe2d7..ed3bd9b5b9 100644 --- a/x/accounts/go.mod +++ b/x/accounts/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/accounts go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 github.com/cosmos/cosmos-sdk v0.51.0 diff --git a/x/auth/autocli.go b/x/auth/autocli.go index 30f06fb593..974daf4df5 100644 --- a/x/auth/autocli.go +++ b/x/auth/autocli.go @@ -80,8 +80,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Service: authv1beta1.Msg_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + RpcMethod: "UpdateParams", + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update auth module params. Note: the entire params must be provided.", + Example: fmt.Sprintf(`%s tx auth update-params-proposal '{ "max_memo_characters": 0, "tx_sig_limit": 0, "tx_size_cost_per_byte": 0, "sig_verify_cost_ed25519": 0, "sig_verify_cost_secp256k1": 0 }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, + GovProposal: true, }, }, }, diff --git a/x/auth/go.mod b/x/auth/go.mod index ade880eebe..6785afd685 100644 --- a/x/auth/go.mod +++ b/x/auth/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/auth go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/auth/go.sum b/x/auth/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/auth/go.sum +++ b/x/auth/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/authz/go.mod b/x/authz/go.mod index 5f02b0acd5..8cd5573af7 100644 --- a/x/authz/go.mod +++ b/x/authz/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/authz go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/bank/autocli.go b/x/bank/autocli.go index 3d1d038acf..065dda0706 100644 --- a/x/bank/autocli.go +++ b/x/bank/autocli.go @@ -1,10 +1,13 @@ package bank import ( + "fmt" "strings" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" bankv1beta1 "cosmossdk.io/api/cosmos/bank/v1beta1" + + "github.com/cosmos/cosmos-sdk/version" ) // AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. @@ -107,12 +110,23 @@ Note: multiple coins can be send by space separated.`, PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "from_address"}, {ProtoField: "amount", Varargs: true}}, }, { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + RpcMethod: "UpdateParams", + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update bank module params. Note: the entire params must be provided.", + Example: fmt.Sprintf(`%s tx bank update-params-proposal '{ "default_send_enabled": true }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, + GovProposal: true, }, { - RpcMethod: "SetSendEnabled", - Skip: true, // skipped because authority gated + RpcMethod: "SetSendEnabled", + Use: "set-send-enabled-proposal [send_enabled]", + Short: "Submit a proposal to set/update/delete send enabled entries", + Example: fmt.Sprintf(`%s tx bank set-send-enabled-proposal '{"denom":"stake","enabled":true}'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "send_enabled", Varargs: true}}, + FlagOptions: map[string]*autocliv1.FlagOptions{ + "use_default_for": {Name: "use-default-for", Usage: "Use default for the given denom (delete a send enabled entry)"}, + }, + GovProposal: true, }, }, }, diff --git a/x/bank/go.mod b/x/bank/go.mod index dcbc38c01d..9e6030ba9e 100644 --- a/x/bank/go.mod +++ b/x/bank/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/bank go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/bank/go.sum b/x/bank/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/bank/go.sum +++ b/x/bank/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/circuit/go.mod b/x/circuit/go.mod index 776c0202d0..dd9908b916 100644 --- a/x/circuit/go.mod +++ b/x/circuit/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/circuit go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/circuit/go.sum b/x/circuit/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/circuit/go.sum +++ b/x/circuit/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/consensus/autocli.go b/x/consensus/autocli.go index 5a2e00900c..14784dced7 100644 --- a/x/consensus/autocli.go +++ b/x/consensus/autocli.go @@ -1,10 +1,13 @@ package consensus import ( + "fmt" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" consensusv1 "cosmossdk.io/api/cosmos/consensus/v1" "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" + "github.com/cosmos/cosmos-sdk/version" ) // AutoCLIOptions implements the autocli.HasAutoCLIConfig interface. @@ -28,7 +31,16 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update consensus module params. Note: the entire params must be provided.", + Example: fmt.Sprintf(`%s tx consensus update-params-proposal '{ params }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{ + {ProtoField: "block"}, + {ProtoField: "evidence"}, + {ProtoField: "validator"}, + {ProtoField: "abci"}, + }, + GovProposal: true, }, }, }, diff --git a/x/crisis/autocli.go b/x/crisis/autocli.go index 92edd95d0c..99586c26b2 100644 --- a/x/crisis/autocli.go +++ b/x/crisis/autocli.go @@ -1,8 +1,11 @@ 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. @@ -21,8 +24,12 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, { - RpcMethod: "UpdateParams", - Skip: true, // Skipped because UpdateParams is authority gated + 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, }, }, }, diff --git a/x/distribution/autocli.go b/x/distribution/autocli.go index b323975c38..fbfde063d9 100644 --- a/x/distribution/autocli.go +++ b/x/distribution/autocli.go @@ -4,7 +4,7 @@ import ( "fmt" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" - distirbuitonv1beta1 "cosmossdk.io/api/cosmos/distribution/v1beta1" + distributionv1beta1 "cosmossdk.io/api/cosmos/distribution/v1beta1" "github.com/cosmos/cosmos-sdk/version" ) @@ -13,7 +13,7 @@ import ( func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { return &autocliv1.ModuleOptions{ Query: &autocliv1.ServiceCommandDescriptor{ - Service: distirbuitonv1beta1.Query_ServiceDesc.ServiceName, + Service: distributionv1beta1.Query_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "Params", @@ -79,7 +79,7 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, Tx: &autocliv1.ServiceCommandDescriptor{ - Service: distirbuitonv1beta1.Msg_ServiceDesc.ServiceName, + Service: distributionv1beta1.Msg_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { RpcMethod: "SetWithdrawAddress", @@ -127,12 +127,16 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + RpcMethod: "UpdateParams", + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update distribution module params. Note: the entire params must be provided.", + Example: fmt.Sprintf(`%s tx distribution update-params-proposal '{ "community_tax": "20000", "base_proposer_reward": "0", "bonus_proposer_reward": "0", "withdraw_addr_enabled": true }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, + GovProposal: true, }, { RpcMethod: "CommunityPoolSpend", - Skip: true, // skipped because authority gated + Skip: true, // skipped because deprecated in favor of protocolpool }, }, EnhanceCustomCommand: true, diff --git a/x/distribution/go.mod b/x/distribution/go.mod index 396771260d..52c1f67a1c 100644 --- a/x/distribution/go.mod +++ b/x/distribution/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/distribution go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/distribution/go.sum b/x/distribution/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/distribution/go.sum +++ b/x/distribution/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/evidence/go.mod b/x/evidence/go.mod index cf53fd2d67..5611880f85 100644 --- a/x/evidence/go.mod +++ b/x/evidence/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/evidence go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/evidence/go.sum b/x/evidence/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/evidence/go.sum +++ b/x/evidence/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/feegrant/go.mod b/x/feegrant/go.mod index 43df73ef91..76bcaf2c27 100644 --- a/x/feegrant/go.mod +++ b/x/feegrant/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/feegrant go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/feegrant/go.sum b/x/feegrant/go.sum index 7da952af9f..4a1e0d1601 100644 --- a/x/feegrant/go.sum +++ b/x/feegrant/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/gov/autocli.go b/x/gov/autocli.go index 8bd6aa49a3..d8c70f3d92 100644 --- a/x/gov/autocli.go +++ b/x/gov/autocli.go @@ -131,8 +131,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + RpcMethod: "UpdateParams", + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update gov module params. Note: the entire params must be provided.", + Long: fmt.Sprintf("Submit a proposal to update gov module params. Note: the entire params must be provided.\n See the fields to fill in by running `%s query gov params --output json`", version.AppName), + Example: fmt.Sprintf(`%s tx gov update-params-proposal '{ params }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, + GovProposal: true, }, }, EnhanceCustomCommand: true, // We still have manual commands in gov that we want to keep diff --git a/x/gov/client/cli/prompt.go b/x/gov/client/cli/prompt.go index 81960fcf90..b2fcca629e 100644 --- a/x/gov/client/cli/prompt.go +++ b/x/gov/client/cli/prompt.go @@ -58,6 +58,8 @@ var suggestedProposalTypes = []proposalType{ // Prompt prompts the user for all values of the given type. // data is the struct to be filled // namePrefix is the name to be displayed as "Enter " +// TODO: when bringing this in autocli, use proto message instead +// this will simplify the get address logic func Prompt[T any](data T, namePrefix string) (T, error) { v := reflect.ValueOf(&data).Elem() if v.Kind() == reflect.Interface { diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index ada07254ac..6167a0bfd8 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -28,6 +28,8 @@ const ( flagStatus = "status" FlagMetadata = "metadata" FlagSummary = "summary" + FlagExpedited = "expedited" + // Deprecated: only used for v1beta1 legacy proposals. FlagProposal = "proposal" // Deprecated: only used for v1beta1 legacy proposals. diff --git a/x/gov/client/cli/util.go b/x/gov/client/cli/util.go index 9b454f9b7f..908de47055 100644 --- a/x/gov/client/cli/util.go +++ b/x/gov/client/cli/util.go @@ -132,13 +132,14 @@ 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") } -// ReadGovPropFlags parses a MsgSubmitProposal from the provided context and flags. +// ReadGovPropCmdFlags parses a MsgSubmitProposal from the provided context and flags. // Setting the messages is up to the caller. // // See also AddGovPropFlagsToCmd. -func ReadGovPropFlags(clientCtx client.Context, flagSet *pflag.FlagSet) (*govv1.MsgSubmitProposal, error) { +func ReadGovPropCmdFlags(proposer string, flagSet *pflag.FlagSet) (*govv1.MsgSubmitProposal, error) { rv := &govv1.MsgSubmitProposal{} deposit, err := flagSet.GetString(FlagDeposit) @@ -167,7 +168,21 @@ func ReadGovPropFlags(clientCtx client.Context, flagSet *pflag.FlagSet) (*govv1. return nil, fmt.Errorf("could not read summary: %w", err) } - rv.Proposer = clientCtx.GetFromAddress().String() + rv.Expedited, err = flagSet.GetBool(FlagExpedited) + if err != nil { + return nil, fmt.Errorf("could not read expedited: %w", err) + } + + rv.Proposer = proposer return rv, nil } + +// ReadGovPropFlags parses a MsgSubmitProposal from the provided context and flags. +// Setting the messages is up to the caller. +// +// See also AddGovPropFlagsToCmd. +// Deprecated: use ReadPropCmdFlags instead, as this depends on global bech32 prefixes. +func ReadGovPropFlags(clientCtx client.Context, flagSet *pflag.FlagSet) (*govv1.MsgSubmitProposal, error) { + return ReadGovPropCmdFlags(clientCtx.GetFromAddress().String(), flagSet) +} diff --git a/x/gov/go.mod b/x/gov/go.mod index 11322e076b..311e2cf477 100644 --- a/x/gov/go.mod +++ b/x/gov/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/gov go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/group/go.mod b/x/group/go.mod index 09be2a5b9d..1cdc24b6e6 100644 --- a/x/group/go.mod +++ b/x/group/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/group go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/group/go.sum b/x/group/go.sum index bf57c0c079..a81b74bfda 100644 --- a/x/group/go.sum +++ b/x/group/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/mint/autocli.go b/x/mint/autocli.go index 8ac35d04b6..bb97ea5258 100644 --- a/x/mint/autocli.go +++ b/x/mint/autocli.go @@ -1,8 +1,11 @@ package mint import ( + "fmt" + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" mintv1beta1 "cosmossdk.io/api/cosmos/mint/v1beta1" + "github.com/cosmos/cosmos-sdk/version" ) func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { @@ -31,8 +34,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Service: mintv1beta1.Msg_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + RpcMethod: "UpdateParams", + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update mint module params. Note: the entire params must be provided.", + Long: fmt.Sprintf("Submit a proposal to update mint module params. Note: the entire params must be provided.\n See the fields to fill in by running `%s query mint params --output json`", version.AppName), + Example: fmt.Sprintf(`%s tx mint update-params-proposal '{ "mint_denom": "stake", ... }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, + GovProposal: true, }, }, }, diff --git a/x/mint/go.mod b/x/mint/go.mod index 301217c51e..c9b21deac8 100644 --- a/x/mint/go.mod +++ b/x/mint/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/mint go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/mint/go.sum b/x/mint/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/mint/go.sum +++ b/x/mint/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/nft/go.mod b/x/nft/go.mod index a2f680539f..171320be58 100644 --- a/x/nft/go.mod +++ b/x/nft/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/nft go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/nft/go.sum b/x/nft/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/nft/go.sum +++ b/x/nft/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/params/go.mod b/x/params/go.mod index 17c3d7b2bc..63640e8d5f 100644 --- a/x/params/go.mod +++ b/x/params/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/params go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/params/go.sum b/x/params/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/params/go.sum +++ b/x/params/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/protocolpool/go.mod b/x/protocolpool/go.mod index 831b4136a0..2656bb8a8c 100644 --- a/x/protocolpool/go.mod +++ b/x/protocolpool/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/protocolpool go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/protocolpool/go.sum b/x/protocolpool/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/protocolpool/go.sum +++ b/x/protocolpool/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/slashing/autocli.go b/x/slashing/autocli.go index fede1143e7..2966d33112 100644 --- a/x/slashing/autocli.go +++ b/x/slashing/autocli.go @@ -46,8 +46,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Example: fmt.Sprintf("%s tx slashing unjail --from [validator]", version.AppName), }, { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + RpcMethod: "UpdateParams", + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update slashing module params. Note: the entire params must be provided.", + Long: fmt.Sprintf("Submit a proposal to update slashing module params. Note: the entire params must be provided.\n See the fields to fill in by running `%s query slashing params --output json`", version.AppName), + Example: fmt.Sprintf(`%s tx slashing update-params-proposal '{ "signed_blocks_window": "100", ... }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, + GovProposal: true, }, }, }, diff --git a/x/slashing/go.mod b/x/slashing/go.mod index 4492c4ac6b..106e8f5453 100644 --- a/x/slashing/go.mod +++ b/x/slashing/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/slashing go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/slashing/go.sum b/x/slashing/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/slashing/go.sum +++ b/x/slashing/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/staking/autocli.go b/x/staking/autocli.go index f708109fd5..d8ed6e8099 100644 --- a/x/staking/autocli.go +++ b/x/staking/autocli.go @@ -174,8 +174,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "validator_address"}, {ProtoField: "amount"}, {ProtoField: "creation_height"}}, }, { - RpcMethod: "UpdateParams", - Skip: true, // skipped because authority gated + RpcMethod: "UpdateParams", + Use: "update-params-proposal [params]", + Short: "Submit a proposal to update staking module params. Note: the entire params must be provided.", + Long: fmt.Sprintf("Submit a proposal to update staking module params. Note: the entire params must be provided.\n See the fields to fill in by running `%s query staking params --output json`", version.AppName), + Example: fmt.Sprintf(`%s tx staking update-params-proposal '{ "unbonding_time": "504h0m0s", ... }'`, version.AppName), + PositionalArgs: []*autocliv1.PositionalArgDescriptor{{ProtoField: "params"}}, + GovProposal: true, }, }, EnhanceCustomCommand: true, diff --git a/x/staking/go.mod b/x/staking/go.mod index 0e9a4b8705..3e940fa6d6 100644 --- a/x/staking/go.mod +++ b/x/staking/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/staking go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 diff --git a/x/staking/go.sum b/x/staking/go.sum index 47b09d4ae4..48c3382ec3 100644 --- a/x/staking/go.sum +++ b/x/staking/go.sum @@ -35,8 +35,8 @@ cloud.google.com/go/storage v1.6.0/go.mod h1:N7U0C8pVQ/+NIKOBQyamJIeKQKkZ+mxpohl cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RXyy7KQOVs= cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0= cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU= diff --git a/x/upgrade/autocli.go b/x/upgrade/autocli.go index 45d076c75e..36265aea32 100644 --- a/x/upgrade/autocli.go +++ b/x/upgrade/autocli.go @@ -49,15 +49,18 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Tx: &autocliv1.ServiceCommandDescriptor{ Service: upgradev1beta1.Msg_ServiceDesc.ServiceName, RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "CancelUpgrade", + Use: "cancel-upgrade-proposal", + Short: "Submit a proposal to cancel a planned chain upgrade.", + GovProposal: true, + }, { RpcMethod: "SoftwareUpgrade", Skip: true, // skipped because authority gated }, - { - RpcMethod: "CancelUpgrade", - Skip: true, // skipped because authority gated - }, }, + EnhanceCustomCommand: true, }, } } diff --git a/x/upgrade/client/cli/tx.go b/x/upgrade/client/cli/tx.go index 7b33515bbb..8c8c4a797f 100644 --- a/x/upgrade/client/cli/tx.go +++ b/x/upgrade/client/cli/tx.go @@ -36,13 +36,13 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( NewCmdSubmitUpgradeProposal(), - NewCmdSubmitCancelUpgradeProposal(), ) return cmd } // NewCmdSubmitUpgradeProposal implements a command handler for submitting a software upgrade proposal transaction. +// This commands is not migrated to autocli as it contains extra validation that is useful for submitting upgrade proposals. func NewCmdSubmitUpgradeProposal() *cobra.Command { cmd := &cobra.Command{ Use: "software-upgrade [name] (--upgrade-height [height]) (--upgrade-info [info]) [flags]", @@ -136,60 +136,6 @@ func NewCmdSubmitUpgradeProposal() *cobra.Command { return cmd } -// NewCmdSubmitCancelUpgradeProposal implements a command handler for submitting a software upgrade cancel proposal transaction. -func NewCmdSubmitCancelUpgradeProposal() *cobra.Command { - cmd := &cobra.Command{ - Use: "cancel-software-upgrade [flags]", - Args: cobra.ExactArgs(0), - Short: "Cancel the current software upgrade proposal", - Long: "Cancel a software upgrade along with an initial deposit.", - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - proposal, err := cli.ReadGovPropFlags(clientCtx, cmd.Flags()) - if err != nil { - return err - } - - authority, _ := cmd.Flags().GetString(FlagAuthority) - if authority != "" { - if _, err = clientCtx.AddressCodec.StringToBytes(authority); err != nil { - return fmt.Errorf("invalid authority address: %w", err) - } - } else { - if authority, err = clientCtx.AddressCodec.BytesToString(address.Module("gov")); err != nil { - return fmt.Errorf("failed to convert authority address to string: %w", err) - } - } - - if err := proposal.SetMsgs([]sdk.Msg{ - &types.MsgCancelUpgrade{ - Authority: authority, - }, - }); err != nil { - return fmt.Errorf("failed to create cancel upgrade proposal message: %w", err) - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), proposal) - }, - } - - cmd.Flags().String(FlagAuthority, "", "The address of the upgrade module authority (defaults to gov)") - - // add common proposal flags - flags.AddTxFlagsToCmd(cmd) - cli.AddGovPropFlagsToCmd(cmd) - err := cmd.MarkFlagRequired(cli.FlagTitle) - if err != nil { - panic(err) - } - - return cmd -} - // getDefaultDaemonName gets the default name to use for the daemon. // If a DAEMON_NAME env var is set, that is used. // Otherwise, the last part of the currently running executable is used. diff --git a/x/upgrade/go.mod b/x/upgrade/go.mod index cb4af9f51a..3b1c83aa27 100644 --- a/x/upgrade/go.mod +++ b/x/upgrade/go.mod @@ -3,7 +3,7 @@ module cosmossdk.io/x/upgrade go 1.21 require ( - cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 + cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a cosmossdk.io/core v0.12.0 cosmossdk.io/depinject v1.0.0-alpha.4 cosmossdk.io/errors v1.0.0 diff --git a/x/upgrade/go.sum b/x/upgrade/go.sum index 792fd05426..62b41286a2 100644 --- a/x/upgrade/go.sum +++ b/x/upgrade/go.sum @@ -187,8 +187,8 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54 h1:c7kl5S1ME0q2g/7cdxngOAZr6N/5L7vVibmrmQZrQ0U= -cosmossdk.io/api v0.7.3-0.20231029200940-6af7f30bfd54/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a h1:Zr++x1RCJWi+K8bTZsQKdjtL4SzyHBLGM3Fcn75iWf0= +cosmossdk.io/api v0.7.3-0.20231113122742-912390d5fc4a/go.mod h1:7B/5XWh1HYwJk3DzWeNoxOSI+nGx1m5UyYfHLFuKzkw= cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= cosmossdk.io/core v0.12.0 h1:aFuvkG6eDv0IQC+UDjx86wxNWVAxdCFk7OABJ1Vh4RU=