Skip to content

Commit

Permalink
refactor: wrong autocli description (#18120)
Browse files Browse the repository at this point in the history
  • Loading branch information
julienrbrt committed Oct 16, 2023
1 parent 437373e commit 3747519
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 20 deletions.
10 changes: 9 additions & 1 deletion x/auth/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
},
}
}
7 changes: 7 additions & 0 deletions x/auth/vesting/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
)

Expand Down Expand Up @@ -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 {
Expand Down
10 changes: 9 additions & 1 deletion x/consensus/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
},
}
}
13 changes: 0 additions & 13 deletions x/gov/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)
Expand Down Expand Up @@ -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{
Expand Down Expand Up @@ -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
},
}
Expand Down
2 changes: 1 addition & 1 deletion x/gov/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down
4 changes: 2 additions & 2 deletions x/group/module/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"},
},
Expand Down
8 changes: 7 additions & 1 deletion x/mint/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
},
}
}
12 changes: 11 additions & 1 deletion x/upgrade/autocli.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
},
},
}
}

0 comments on commit 3747519

Please sign in to comment.