Skip to content

Commit

Permalink
Add tendermint version command (#3285)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackzampolin authored Jan 14, 2019
2 parents baac2bc + 145fe81 commit ac82950
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions PENDING.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ BREAKING CHANGES
* https://github.com/cosmos/cosmos-sdk/issues/2838 - Move store keys to constants
* [\#3162](https://github.com/cosmos/cosmos-sdk/issues/3162) The `--gas` flag now takes `auto` instead of `simulate`
in order to trigger a simulation of the tx before the actual execution.
* [\#3285](https://github.com/cosmos/cosmos-sdk/pull/3285) New `gaiad tendermint version` to print libs versions

* SDK
* [staking] \#2513 Validator power type from Dec -> Int
Expand Down
28 changes: 28 additions & 0 deletions server/tm_cmds.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,20 @@ import (
tcmd "github.com/tendermint/tendermint/cmd/tendermint/commands"
"github.com/tendermint/tendermint/p2p"
pvm "github.com/tendermint/tendermint/privval"
tversion "github.com/tendermint/tendermint/version"

"github.com/cosmos/cosmos-sdk/client"
sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
versionString = `Tendermint: %s
ABCI: %s
BlockProtocol: %d
P2PProtocol: %d
`
)

// ShowNodeIDCmd - ported from Tendermint, dump node ID to stdout
func ShowNodeIDCmd(ctx *Context) *cobra.Command {
return &cobra.Command{
Expand Down Expand Up @@ -89,6 +98,25 @@ func ShowAddressCmd(ctx *Context) *cobra.Command {
return cmd
}

// VersionCmd prints tendermint and ABCI version numbers.
func VersionCmd(ctx *Context) *cobra.Command {
cmd := &cobra.Command{
Use: "version",
Short: "Print tendermint libraries' version",
Long: `Print protocols' and libraries' version numbers
against which this app has been compiled.
`,
RunE: func(cmd *cobra.Command, args []string) error {

fmt.Printf(versionString, tversion.Version, tversion.ABCIVersion,
tversion.BlockProtocol.Uint64(), tversion.P2PProtocol.Uint64())

return nil
},
}
return cmd
}

func printlnJSON(v interface{}) error {
cdc := codec.New()
codec.RegisterCrypto(cdc)
Expand Down
1 change: 1 addition & 0 deletions server/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ func AddCommands(
ShowNodeIDCmd(ctx),
ShowValidatorCmd(ctx),
ShowAddressCmd(ctx),
VersionCmd(ctx),
)

rootCmd.AddCommand(
Expand Down

0 comments on commit ac82950

Please sign in to comment.