Browse Source

Merge branch 'release/0.7.1'

pull/1780/head
Anton Kaliaev 7 years ago
parent
commit
76ef8a0697
No known key found for this signature in database GPG Key ID: 7B6881D965918214
14 changed files with 86 additions and 64 deletions
  1. +13
    -5
      CHANGELOG.md
  2. +5
    -5
      Makefile
  3. +2
    -2
      README.md
  4. +16
    -2
      cmd/abci-cli/abci-cli.go
  5. +3
    -3
      example/dummy/dummy_test.go
  6. +3
    -3
      example/example_test.go
  7. +5
    -6
      glide.lock
  8. +4
    -4
      glide.yaml
  9. +1
    -1
      scripts/abci-builder/Dockerfile
  10. +29
    -28
      server/socket_server.go
  11. +1
    -1
      tests/test_app/app.go
  12. +1
    -1
      tests/test_app/test.sh
  13. +1
    -1
      tests/test_cli/test.sh
  14. +2
    -2
      version/version.go

+ 13
- 5
CHANGELOG.md View File

@ -1,5 +1,13 @@
# Changelog
## 0.7.1 (November 14, 2017)
IMPROVEMENTS:
- [cli] added version command
BUG FIXES:
- [server] fix "Connection error module=abci-server error=EOF"
## 0.7.0 (October 27, 2017)
BREAKING CHANGES:
@ -43,7 +51,7 @@ IMPROVEMENTS:
- Update imports for new `tmlibs` repository
- Use the new logger
- [abci-cli] Add flags to the query command for `path`, `height`, and `prove`
- [types] use `data.Bytes` and `json` tags in the `Result` struct
- [types] use `data.Bytes` and `json` tags in the `Result` struct
BUG FIXES:
@ -55,9 +63,9 @@ IMPROVEMENTS:
## 0.4.0 (March 6, 2017)
BREAKING CHANGES:
BREAKING CHANGES:
- Query takes RequestQuery and returns ResponseQuery. The request is split into `data` and `path`,
- Query takes RequestQuery and returns ResponseQuery. The request is split into `data` and `path`,
can specify a height to query the state from, and whether or not the response should come with a proof.
The response returns the corresponding key-value pair, with proof if requested.
@ -66,7 +74,7 @@ message RequestQuery{
bytes data = 1;
string path = 2;
uint64 height = 3;
bool prove = 4;
bool prove = 4;
}
message ResponseQuery{
@ -142,7 +150,7 @@ message Header {
bytes last_commit_hash = 6;
bytes data_hash = 7;
bytes validators_hash = 8;
bytes app_hash = 9;
bytes app_hash = 9;
}
message BlockID {


+ 5
- 5
Makefile View File

@ -5,7 +5,7 @@ GOTOOLS = \
all: protoc install test
NOVENDOR = go list github.com/tendermint/abci/... | grep -v /vendor/
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
install-protoc:
# Download: https://github.com/google/protobuf/releases
@ -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
@ -27,7 +27,7 @@ dist:
# test.sh requires that we run the installed cmds, must not be out of date
test: install
find . -path ./vendor -prune -o -name *.sock -exec rm {} \;
@ go test -p 1 `${NOVENDOR}`
@ go test $(PACKAGES)
@ bash tests/test.sh
fmt:
@ -36,7 +36,7 @@ fmt:
test_integrations: get_vendor_deps install test
get_deps:
@ go get -d `${NOVENDOR}`
@ go get -d $(PACKAGES)
tools:
go get -u -v $(GOTOOLS)


+ 2
- 2
README.md View File

@ -13,8 +13,8 @@ to manage an application state running in another.
```
go get github.com/tendermint/abci
cd $GOPATH/src/github.com/tendermint/abci
glide install
go install ./cmd/...
make get_vendor_deps
make install
```
For background information on ABCI, motivations, and tendermint, please visit [the documentation](http://tendermint.readthedocs.io/en/master/).


+ 16
- 2
cmd/abci-cli/abci-cli.go View File

@ -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",


+ 3
- 3
example/dummy/dummy_test.go View File

@ -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


+ 3
- 3
example/example_test.go View File

@ -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())


+ 5
- 6
glide.lock View File

@ -1,5 +1,5 @@
hash: 3c8680f0a289567a29f737be5f1d5f242c7e2afd84bdd023dd74596b88508fc2
updated: 2017-10-27T12:12:58.940745472-04:00
hash: 5501ab3d7136aa8fb425c995d45221849b33aefab76c5d2c192e721dad28da38
updated: 2017-11-14T18:23:41.2024073Z
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: 1c96861c03231361546944d883d99593b2e6b408
subpackages:
- data
- name: github.com/tendermint/iavl
version: 595f3dcd5b6cd4a292e90757ae6d367fd7a6e653
- name: github.com/tendermint/tmlibs
version: 092eb701c7276907cdbed258750e22ce895b6735
version: 2442a0a698d271d5cf5d6a8e7c1db20335e959c1
subpackages:
- common
- db
- log
- merkle
- process
- name: golang.org/x/crypto
version: c7af5bf2638a1164f2eb5467c39c6cffbd13a02e


+ 4
- 4
glide.yaml View File

@ -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

+ 1
- 1
scripts/abci-builder/Dockerfile View File

@ -1,4 +1,4 @@
FROM golang:1.7.4
FROM golang:1.9.2
RUN apt-get update && apt-get install -y --no-install-recommends \
zip \


+ 29
- 28
server/socket_server.go View File

@ -59,11 +59,11 @@ func (s *SocketServer) OnStop() {
s.listener.Close()
s.connsMtx.Lock()
defer s.connsMtx.Unlock()
for id, conn := range s.conns {
delete(s.conns, id)
conn.Close()
}
s.connsMtx.Unlock()
}
func (s *SocketServer) addConn(conn net.Conn) int {
@ -78,20 +78,21 @@ func (s *SocketServer) addConn(conn net.Conn) int {
}
// deletes conn even if close errs
func (s *SocketServer) rmConn(connID int, conn net.Conn) error {
func (s *SocketServer) rmConn(connID int) error {
s.connsMtx.Lock()
defer s.connsMtx.Unlock()
conn, ok := s.conns[connID]
if !ok {
return fmt.Errorf("Connection %d does not exist", connID)
}
delete(s.conns, connID)
return conn.Close()
}
func (s *SocketServer) acceptConnectionsRoutine() {
// semaphore := make(chan struct{}, maxNumberConnections)
for {
// semaphore <- struct{}{}
// Accept a connection
s.Logger.Info("Waiting for new connection...")
conn, err := s.listener.Accept()
@ -100,10 +101,11 @@ func (s *SocketServer) acceptConnectionsRoutine() {
return // Ignore error from listener closing.
}
s.Logger.Error("Failed to accept connection: " + err.Error())
} else {
s.Logger.Info("Accepted a new connection")
continue
}
s.Logger.Info("Accepted a new connection")
connID := s.addConn(conn)
closeConn := make(chan error, 2) // Push to signal connection closed
@ -112,28 +114,27 @@ func (s *SocketServer) acceptConnectionsRoutine() {
// Read requests from conn and deal with them
go s.handleRequests(closeConn, conn, responses)
// Pull responses from 'responses' and write them to conn.
go s.handleResponses(closeConn, responses, conn)
go s.handleResponses(closeConn, conn, responses)
go func() {
// Wait until signal to close connection
errClose := <-closeConn
if err == io.EOF {
s.Logger.Error("Connection was closed by client")
} else if errClose != nil {
s.Logger.Error("Connection error", "error", errClose)
} else {
// never happens
s.Logger.Error("Connection was closed.")
}
// Wait until signal to close connection
go s.waitForClose(closeConn, connID)
}
}
// Close the connection
err := s.rmConn(connID, conn)
if err != nil {
s.Logger.Error("Error in closing connection", "error", err)
}
func (s *SocketServer) waitForClose(closeConn chan error, connID int) {
err := <-closeConn
if err == io.EOF {
s.Logger.Error("Connection was closed by client")
} else if err != nil {
s.Logger.Error("Connection error", "error", err)
} else {
// never happens
s.Logger.Error("Connection was closed.")
}
// <-semaphore
}()
// Close the connection
if err := s.rmConn(connID); err != nil {
s.Logger.Error("Error in closing connection", "error", err)
}
}
@ -200,7 +201,7 @@ func (s *SocketServer) handleRequest(req *types.Request, responses chan<- *types
}
// Pull responses from 'responses' and write them to conn.
func (s *SocketServer) handleResponses(closeConn chan error, responses <-chan *types.Response, conn net.Conn) {
func (s *SocketServer) handleResponses(closeConn chan error, conn net.Conn, responses <-chan *types.Response) {
var count int
var bufWriter = bufio.NewWriter(conn)
for {


+ 1
- 1
tests/test_app/app.go View File

@ -18,7 +18,7 @@ func startApp(abciApp string) *process.Process {
proc, err := process.StartProcess("abci_app",
"",
"bash",
[]string{"-c", abciApp},
[]string{"-c", fmt.Sprintf("abci-cli %s", abciApp)},
nil,
os.Stdout,
)


+ 1
- 1
tests/test_app/test.sh View File

@ -15,7 +15,7 @@ cd "$DIR"
ABCI_APP="counter" go run ./*.go
# test golang counter via grpc
ABCI_APP="counter -abci=grpc" ABCI="grpc" go run ./*.go
ABCI_APP="counter --abci=grpc" ABCI="grpc" go run ./*.go
# test nodejs counter
# TODO: fix node app


+ 1
- 1
tests/test_cli/test.sh View File

@ -17,7 +17,7 @@ function testExample() {
$APP &> /dev/null &
sleep 2
abci-cli --verbose batch < "$INPUT" > "${INPUT}.out.new"
killall $3
killall "$3"
pre=$(shasum < "${INPUT}.out")
post=$(shasum < "${INPUT}.out.new")


+ 2
- 2
version/version.go View File

@ -4,6 +4,6 @@ package version
const Maj = "0"
const Min = "7"
const Fix = "0"
const Fix = "1"
const Version = "0.7.0"
const Version = "0.7.1"

Loading…
Cancel
Save