From 3747519da0e3582e66db225a85e04e6f5d6a1682 Mon Sep 17 00:00:00 2001 From: Julien Robert Date: Mon, 16 Oct 2023 11:54:23 +0200 Subject: [PATCH] refactor: wrong autocli description (#18120) --- x/auth/autocli.go | 10 +++++++++- x/auth/vesting/module.go | 7 +++++++ x/consensus/autocli.go | 10 +++++++++- x/gov/autocli.go | 13 ------------- x/gov/client/cli/tx.go | 2 +- x/group/module/autocli.go | 4 ++-- x/mint/autocli.go | 8 +++++++- x/upgrade/autocli.go | 12 +++++++++++- 8 files changed, 46 insertions(+), 20 deletions(-) diff --git a/x/auth/autocli.go b/x/auth/autocli.go index c7b52e42e0c0..30f06fb5936f 100644 --- a/x/auth/autocli.go +++ b/x/auth/autocli.go @@ -76,6 +76,14 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, }, - // Tx is purposely left empty, as the only tx is MsgUpdateParams which is gov gated. + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: authv1beta1.Msg_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + }, + }, } } diff --git a/x/auth/vesting/module.go b/x/auth/vesting/module.go index 3408a36dbd91..665315aaadc9 100644 --- a/x/auth/vesting/module.go +++ b/x/auth/vesting/module.go @@ -5,6 +5,7 @@ import ( "encoding/json" gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" "google.golang.org/grpc" modulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" @@ -16,6 +17,7 @@ import ( codectypes "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth/keeper" + "github.com/cosmos/cosmos-sdk/x/auth/vesting/client/cli" "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" ) @@ -62,6 +64,11 @@ func (AppModuleBasic) ValidateGenesis(_ codec.JSONCodec, _ client.TxEncodingConf // is a no-op. func (AppModuleBasic) RegisterGRPCGatewayRoutes(_ client.Context, _ *gwruntime.ServeMux) {} +// GetTxCmd returns the root tx command for the vesting module. +func (amb AppModuleBasic) GetTxCmd() *cobra.Command { + return cli.GetTxCmd() +} + // AppModule extends the AppModuleBasic implementation by implementing the // AppModule interface. type AppModule struct { diff --git a/x/consensus/autocli.go b/x/consensus/autocli.go index a8bb0f49c618..5a2e00900cc4 100644 --- a/x/consensus/autocli.go +++ b/x/consensus/autocli.go @@ -23,6 +23,14 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { "comet": cmtservice.CometBFTAutoCLIDescriptor, }, }, - // Tx is purposely left empty, as the only tx is MsgUpdateParams which is gov gated. + Tx: &autocliv1.ServiceCommandDescriptor{ + Service: consensusv1.Msg_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + }, + }, } } diff --git a/x/gov/autocli.go b/x/gov/autocli.go index 0db336e35d2e..de030f2b26da 100644 --- a/x/gov/autocli.go +++ b/x/gov/autocli.go @@ -5,7 +5,6 @@ import ( autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" govv1 "cosmossdk.io/api/cosmos/gov/v1" - govv1beta1 "cosmossdk.io/api/cosmos/gov/v1beta1" "github.com/cosmos/cosmos-sdk/version" ) @@ -91,12 +90,6 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Short: "Query the current chain constitution", }, }, - // map v1beta1 as a sub-command - SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{ - "v1beta1": { - Service: govv1beta1.Query_ServiceDesc.ServiceName, - }, - }, EnhanceCustomCommand: true, // We still have manual commands in gov that we want to keep }, Tx: &autocliv1.ServiceCommandDescriptor{ @@ -141,12 +134,6 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { Skip: true, // skipped because authority gated }, }, - // map v1beta1 as a sub-command - SubCommands: map[string]*autocliv1.ServiceCommandDescriptor{ - "v1beta1": { - Service: govv1beta1.Msg_ServiceDesc.ServiceName, - }, - }, EnhanceCustomCommand: true, // We still have manual commands in gov that we want to keep }, } diff --git a/x/gov/client/cli/tx.go b/x/gov/client/cli/tx.go index a31115ebb44e..f95d1d3d9761 100644 --- a/x/gov/client/cli/tx.go +++ b/x/gov/client/cli/tx.go @@ -232,7 +232,7 @@ func NewCmdWeightedVote() *cobra.Command { find the proposal-id by running "%s query gov proposals". Example: -$ %s tx gov weighted-vote 1 yes=0.6,no=0.3,abstain=0.05,no_with_veto=0.05 --from mykey +$ %s tx gov weighted-vote 1 yes=0.6,no=0.3,abstain=0.05,no-with-veto=0.05 --from mykey `, version.AppName, version.AppName, ), diff --git a/x/group/module/autocli.go b/x/group/module/autocli.go index 51defc6f6b25..bc52c5558f85 100644 --- a/x/group/module/autocli.go +++ b/x/group/module/autocli.go @@ -153,8 +153,8 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, { RpcMethod: "UpdateGroupPolicyMetadata", - Use: "update-group-policy-admin [admin] [group-policy-account] [new-admin]", - Short: "Update a group policy admin", + Use: "update-group-policy-metadata [admin] [group-policy-account] [new-metadata]", + Short: "Update a group policy metadata", PositionalArgs: []*autocliv1.PositionalArgDescriptor{ {ProtoField: "admin"}, {ProtoField: "group_policy_address"}, {ProtoField: "metadata"}, }, diff --git a/x/mint/autocli.go b/x/mint/autocli.go index 2f3bcb28c645..8ac35d04b6c8 100644 --- a/x/mint/autocli.go +++ b/x/mint/autocli.go @@ -28,7 +28,13 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, Tx: &autocliv1.ServiceCommandDescriptor{ - Service: mintv1beta1.Query_ServiceDesc.ServiceName, + Service: mintv1beta1.Msg_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "UpdateParams", + Skip: true, // skipped because authority gated + }, + }, }, } } diff --git a/x/upgrade/autocli.go b/x/upgrade/autocli.go index 7c295f30a50f..45d076c75eda 100644 --- a/x/upgrade/autocli.go +++ b/x/upgrade/autocli.go @@ -47,7 +47,17 @@ func (am AppModule) AutoCLIOptions() *autocliv1.ModuleOptions { }, }, Tx: &autocliv1.ServiceCommandDescriptor{ - Service: upgradev1beta1.Query_ServiceDesc.ServiceName, + Service: upgradev1beta1.Msg_ServiceDesc.ServiceName, + RpcCommandOptions: []*autocliv1.RpcCommandOptions{ + { + RpcMethod: "SoftwareUpgrade", + Skip: true, // skipped because authority gated + }, + { + RpcMethod: "CancelUpgrade", + Skip: true, // skipped because authority gated + }, + }, }, } }