From ecb1f02f770eeb52bb85e16998f66e552296bf86 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 8 Nov 2017 17:18:42 -0500 Subject: [PATCH 1/4] add version cmd (Refs #124) --- cmd/abci-cli/abci-cli.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/cmd/abci-cli/abci-cli.go b/cmd/abci-cli/abci-cli.go index 1beb08507..9962380b4 100644 --- a/cmd/abci-cli/abci-cli.go +++ b/cmd/abci-cli/abci-cli.go @@ -15,6 +15,7 @@ import ( "github.com/tendermint/abci/example/dummy" "github.com/tendermint/abci/server" "github.com/tendermint/abci/types" + "github.com/tendermint/abci/version" cmn "github.com/tendermint/tmlibs/common" "github.com/tendermint/tmlibs/log" @@ -71,8 +72,9 @@ var RootCmd = &cobra.Command{ PersistentPreRunE: func(cmd *cobra.Command, args []string) error { switch cmd.Use { - // for the examples apps, don't pre-run - case "counter", "dummy": + case "counter", "dummy": // for the examples apps, don't pre-run + return nil + case "version": // skip running for version command return nil } @@ -130,6 +132,7 @@ func addCommands() { RootCmd.AddCommand(deliverTxCmd) RootCmd.AddCommand(checkTxCmd) RootCmd.AddCommand(commitCmd) + RootCmd.AddCommand(versionCmd) addQueryFlags() RootCmd.AddCommand(queryCmd) @@ -219,6 +222,17 @@ var commitCmd = &cobra.Command{ }, } +var versionCmd = &cobra.Command{ + Use: "version", + Short: "Print abci console version", + Long: "", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + fmt.Println(version.Version) + return nil + }, +} + var queryCmd = &cobra.Command{ Use: "query", Short: "Query the application state", From 5efe88cd107080d032ba8c73dd4e857e13cc2bd2 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 8 Nov 2017 17:18:52 -0500 Subject: [PATCH 2/4] simplify Makefile install and build commands --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 588e12df5..a22a2e902 100644 --- a/Makefile +++ b/Makefile @@ -15,10 +15,10 @@ protoc: @ protoc --go_out=plugins=grpc:. types/*.proto install: - @ go install github.com/tendermint/abci/cmd/... + @ go install ./cmd/... build: - @ go build -i github.com/tendermint/abci/cmd/... + @ go build -i ./cmd/... dist: @ bash scripts/dist.sh From 430c49ea143b76cc419b2f2c6c0779ea715db823 Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 8 Nov 2017 17:19:35 -0500 Subject: [PATCH 3/4] update deps --- glide.lock | 11 +++++------ glide.yaml | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/glide.lock b/glide.lock index 2a992d724..755521863 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 3c8680f0a289567a29f737be5f1d5f242c7e2afd84bdd023dd74596b88508fc2 -updated: 2017-10-27T12:12:58.940745472-04:00 +hash: 5501ab3d7136aa8fb425c995d45221849b33aefab76c5d2c192e721dad28da38 +updated: 2017-11-08T22:19:19.433856551Z imports: - name: github.com/btcsuite/btcd version: b8df516b4b267acf2de46be593a9d948d1d2c420 @@ -66,20 +66,19 @@ imports: - edwards25519 - extra25519 - name: github.com/tendermint/go-crypto - version: db5603e37435933c13665a708055fadd18222f5f + version: b4f04f196cd719660e43b91202cd60d9a95b1837 - name: github.com/tendermint/go-wire - version: 8ee84b5b2581530168daf66fc89c548d27403c57 + version: 2baffcb6b690057568bc90ef1d457efb150b979a subpackages: - data - name: github.com/tendermint/iavl version: 595f3dcd5b6cd4a292e90757ae6d367fd7a6e653 - name: github.com/tendermint/tmlibs - version: 092eb701c7276907cdbed258750e22ce895b6735 + version: 176c2ceed611d7735e39131e312bd973afb41b7b subpackages: - common - db - log - - merkle - process - name: golang.org/x/crypto version: c7af5bf2638a1164f2eb5467c39c6cffbd13a02e diff --git a/glide.yaml b/glide.yaml index ccd41cdc3..ce8057234 100644 --- a/glide.yaml +++ b/glide.yaml @@ -3,11 +3,13 @@ import: - package: github.com/golang/protobuf subpackages: - proto -- package: github.com/pkg/errors +- package: github.com/spf13/cobra - package: github.com/tendermint/go-crypto version: develop - package: github.com/tendermint/go-wire version: develop + subpackages: + - data - package: github.com/tendermint/iavl version: develop - package: github.com/tendermint/tmlibs @@ -16,10 +18,7 @@ import: - common - db - log - - merkle - process -- package: github.com/spf13/cobra - version: master - package: golang.org/x/net subpackages: - context @@ -27,4 +26,5 @@ import: testImport: - package: github.com/stretchr/testify subpackages: + - assert - require From 10e1233f1420e6b244ee1366485e18d58ef981fb Mon Sep 17 00:00:00 2001 From: Anton Kaliaev Date: Wed, 8 Nov 2017 17:29:15 -0500 Subject: [PATCH 4/4] fix megacheck issues --- example/dummy/dummy_test.go | 6 +++--- example/example_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/example/dummy/dummy_test.go b/example/dummy/dummy_test.go index 751a2e910..efbc5af77 100644 --- a/example/dummy/dummy_test.go +++ b/example/dummy/dummy_test.go @@ -8,7 +8,7 @@ import ( "github.com/stretchr/testify/require" abcicli "github.com/tendermint/abci/client" - "github.com/tendermint/abci/server" + abciserver "github.com/tendermint/abci/server" "github.com/tendermint/abci/types" "github.com/tendermint/iavl" cmn "github.com/tendermint/tmlibs/common" @@ -210,7 +210,7 @@ func makeSocketClientServer(app types.Application, name string) (abcicli.Client, socket := cmn.Fmt("unix://%s.sock", name) logger := log.TestingLogger() - server := server.NewSocketServer(socket, app) + server := abciserver.NewSocketServer(socket, app) server.SetLogger(logger.With("module", "abci-server")) if _, err := server.Start(); err != nil { return nil, nil, err @@ -233,7 +233,7 @@ func makeGRPCClientServer(app types.Application, name string) (abcicli.Client, c logger := log.TestingLogger() gapp := types.NewGRPCApplication(app) - server := server.NewGRPCServer(socket, gapp) + server := abciserver.NewGRPCServer(socket, gapp) server.SetLogger(logger.With("module", "abci-server")) if _, err := server.Start(); err != nil { return nil, nil, err diff --git a/example/example_test.go b/example/example_test.go index e9505f223..496ed3d3f 100644 --- a/example/example_test.go +++ b/example/example_test.go @@ -13,7 +13,7 @@ import ( abcicli "github.com/tendermint/abci/client" "github.com/tendermint/abci/example/dummy" - "github.com/tendermint/abci/server" + abciserver "github.com/tendermint/abci/server" "github.com/tendermint/abci/types" cmn "github.com/tendermint/tmlibs/common" "github.com/tendermint/tmlibs/log" @@ -38,7 +38,7 @@ func testStream(t *testing.T, app types.Application) { numDeliverTxs := 200000 // Start the listener - server := server.NewSocketServer("unix://test.sock", app) + server := abciserver.NewSocketServer("unix://test.sock", app) server.SetLogger(log.TestingLogger().With("module", "abci-server")) if _, err := server.Start(); err != nil { t.Fatalf("Error starting socket server: %v", err.Error()) @@ -111,7 +111,7 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) { numDeliverTxs := 2000 // Start the listener - server := server.NewGRPCServer("unix://test.sock", app) + server := abciserver.NewGRPCServer("unix://test.sock", app) server.SetLogger(log.TestingLogger().With("module", "abci-server")) if _, err := server.Start(); err != nil { t.Fatalf("Error starting GRPC server: %v", err.Error())