Skip to content
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

feat: add tm inspect cmd #11548

Merged
merged 4 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Features

* (cli) [\#11548](https://github.com/cosmos/cosmos-sdk/pull/11548) Add Tendermint's `inspect` command to the `tendermint` sub-command.
* (tx) [#\11533](https://github.com/cosmos/cosmos-sdk/pull/11533) Register [`EIP191`](https://eips.ethereum.org/EIPS/eip-191) as an available `SignMode` for chains to use.
* (x/genutil) [\#11500](https://github.com/cosmos/cosmos-sdk/pull/11500) Fix GenTx validation and adjust error messages
* [\#11430](https://github.com/cosmos/cosmos-sdk/pull/11430) Introduce a new `grpc-only` flag, such that when enabled, will start the node in a query-only mode. Note, gRPC MUST be enabled with this flag.
Expand Down
21 changes: 15 additions & 6 deletions server/tm_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"fmt"

"github.com/spf13/cobra"
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
tmcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
pvm "github.com/tendermint/tendermint/privval"
tversion "github.com/tendermint/tendermint/version"
"sigs.k8s.io/yaml"
Expand All @@ -29,6 +29,7 @@ func ShowNodeIDCmd() *cobra.Command {
if err != nil {
return err
}

fmt.Println(nodeKey)
return nil
},
Expand All @@ -48,19 +49,23 @@ func ShowValidatorCmd() *cobra.Command {
if err != nil {
return err
}

pk, err := privValidator.GetPubKey(cmd.Context())
if err != nil {
return err
}

sdkPK, err := cryptocodec.FromTmPubKeyInterface(pk)
if err != nil {
return err
}

clientCtx := client.GetClientContextFromCmd(cmd)
bz, err := clientCtx.Codec.MarshalInterfaceJSON(sdkPK)
if err != nil {
return err
}

fmt.Println(string(bz))
return nil
},
Expand All @@ -82,6 +87,7 @@ func ShowAddressCmd() *cobra.Command {
if err != nil {
return err
}

valConsAddr := (sdk.ConsAddress)(privValidator.GetAddress())
fmt.Println(valConsAddr.String())
return nil
Expand All @@ -96,9 +102,7 @@ func VersionCmd() *cobra.Command {
return &cobra.Command{
Use: "version",
Short: "Print tendermint libraries' version",
Long: `Print protocols' and libraries' version numbers
against which this app has been compiled.
`,
Long: "Print protocols' and libraries' version numbers against which this app has been compiled.",
RunE: func(cmd *cobra.Command, args []string) error {
bs, err := yaml.Marshal(&struct {
Tendermint string
Expand Down Expand Up @@ -130,8 +134,13 @@ func UnsafeResetAllCmd() *cobra.Command {
serverCtx := GetServerContextFromCmd(cmd)
cfg := serverCtx.Config

tcmd.ResetAll(cfg.DBDir(), cfg.P2P.AddrBookFile(), cfg.PrivValidator.KeyFile(), cfg.PrivValidator.StateFile(), serverCtx.Logger)
return nil
return tmcmd.ResetAll(
cfg.DBDir(),
cfg.P2P.AddrBookFile(),
cfg.PrivValidator.KeyFile(),
cfg.PrivValidator.StateFile(),
serverCtx.Logger,
)
},
}
}
3 changes: 3 additions & 0 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"
"github.com/spf13/viper"
tmcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
tmcfg "github.com/tendermint/tendermint/config"
tmlog "github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"
Expand Down Expand Up @@ -271,7 +272,9 @@ func AddCommands(rootCmd *cobra.Command, defaultNodeHome string, appCreator type
ShowValidatorCmd(),
ShowAddressCmd(),
VersionCmd(),
tmcmd.InspectCmd,
)

startCmd := StartCmd(appCreator, defaultNodeHome)
addStartFlags(startCmd)

Expand Down