From ee9dd2250d5087b067986ca13d228f4404245970 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Sat, 12 Jan 2019 04:30:16 +0000 Subject: [PATCH 1/2] Add tendermint version command --- PENDING.md | 1 + server/tm_cmds.go | 21 +++++++++++++++++++++ server/util.go | 1 + 3 files changed, 23 insertions(+) diff --git a/PENDING.md b/PENDING.md index 490fd171fa9e..89537e412bdf 100644 --- a/PENDING.md +++ b/PENDING.md @@ -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 diff --git a/server/tm_cmds.go b/server/tm_cmds.go index 9d8351711599..e2c57b761e2e 100644 --- a/server/tm_cmds.go +++ b/server/tm_cmds.go @@ -11,6 +11,7 @@ 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" @@ -89,6 +90,26 @@ 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 Tendermint's and ABCI's version numbers +against which this app has been compiled. +`, + RunE: func(cmd *cobra.Command, args []string) error { + + fmt.Printf(`tendermint: %s +ABCI: %s +`, tversion.Version, tversion.ABCIVersion) + + return nil + }, + } + return cmd +} + func printlnJSON(v interface{}) error { cdc := codec.New() codec.RegisterCrypto(cdc) diff --git a/server/util.go b/server/util.go index dec3a6d4aa1e..5092cab9ad81 100644 --- a/server/util.go +++ b/server/util.go @@ -142,6 +142,7 @@ func AddCommands( ShowNodeIDCmd(ctx), ShowValidatorCmd(ctx), ShowAddressCmd(ctx), + VersionCmd(ctx), ) rootCmd.AddCommand( From 145fe81544382e1c78476251a3c038dfb68e22e0 Mon Sep 17 00:00:00 2001 From: Alessio Treglia Date: Mon, 14 Jan 2019 13:38:52 +0000 Subject: [PATCH 2/2] Include Block and P2P protocols versions --- server/tm_cmds.go | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/server/tm_cmds.go b/server/tm_cmds.go index e2c57b761e2e..ec2bacc7ed80 100644 --- a/server/tm_cmds.go +++ b/server/tm_cmds.go @@ -17,6 +17,14 @@ import ( 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{ @@ -95,14 +103,13 @@ func VersionCmd(ctx *Context) *cobra.Command { cmd := &cobra.Command{ Use: "version", Short: "Print tendermint libraries' version", - Long: `Print Tendermint's and ABCI's version numbers + Long: `Print protocols' and libraries' version numbers against which this app has been compiled. `, RunE: func(cmd *cobra.Command, args []string) error { - fmt.Printf(`tendermint: %s -ABCI: %s -`, tversion.Version, tversion.ABCIVersion) + fmt.Printf(versionString, tversion.Version, tversion.ABCIVersion, + tversion.BlockProtocol.Uint64(), tversion.P2PProtocol.Uint64()) return nil },