Browse Source

Merge pull request #47 from tendermint/rename

Rename
pull/1780/head
Ethan Buchman 8 years ago
committed by GitHub
parent
commit
624dca61b3
54 changed files with 381 additions and 379 deletions
  1. +1
    -1
      LICENSE
  2. +2
    -2
      Makefile
  3. +20
    -20
      README.md
  4. +5
    -5
      client/client.go
  5. +13
    -13
      client/grpc_client.go
  6. +8
    -8
      client/local_client.go
  7. +2
    -2
      client/log.go
  8. +11
    -11
      client/socket_client.go
  9. +15
    -15
      cmd/abci-cli/tmsp-cli.go
  10. +4
    -4
      cmd/counter/main.go
  11. +5
    -5
      cmd/dummy/main.go
  12. +5
    -5
      example/chain_aware/chain_aware_app.go
  13. +4
    -4
      example/chain_aware/chain_aware_test.go
  14. +2
    -2
      example/counter/counter.go
  15. +1
    -1
      example/dummy/README.md
  16. +2
    -2
      example/dummy/dummy.go
  17. +7
    -7
      example/dummy/dummy_test.go
  18. +3
    -3
      example/dummy/persistent_dummy.go
  19. +24
    -24
      example/example_test.go
  20. +1
    -1
      example/js/README.md
  21. +2
    -2
      example/nil/nil_app.go
  22. +0
    -0
      example/python/abci/__init__.py
  23. +3
    -3
      example/python/abci/msg.py
  24. +0
    -0
      example/python/abci/reader.py
  25. +2
    -2
      example/python/abci/server.py
  26. +0
    -0
      example/python/abci/wire.py
  27. +6
    -6
      example/python/app.py
  28. +0
    -0
      example/python3/abci/__init__.py
  29. +3
    -3
      example/python3/abci/msg.py
  30. +0
    -0
      example/python3/abci/reader.py
  31. +2
    -2
      example/python3/abci/server.py
  32. +0
    -0
      example/python3/abci/wire.py
  33. +6
    -6
      example/python3/app.py
  34. +1
    -1
      glide.yaml
  35. +5
    -5
      server/grpc_server.go
  36. +1
    -1
      server/log.go
  37. +1
    -1
      server/server.go
  38. +5
    -5
      server/socket_server.go
  39. +1
    -1
      tests/benchmarks/parallel/parallel.go
  40. +1
    -1
      tests/benchmarks/simple/simple.go
  41. +16
    -16
      tests/test_app/app.go
  42. +19
    -19
      tests/test_app/main.go
  43. +5
    -5
      tests/test_app/test.sh
  44. +2
    -2
      tests/test_cli/ex1.abci
  45. +2
    -2
      tests/test_cli/ex1.abci.out
  46. +3
    -3
      tests/test_cli/ex2.abci
  47. +3
    -3
      tests/test_cli/ex2.abci.out
  48. +5
    -3
      tests/test_cli/test.sh
  49. +1
    -1
      testutil/messages.go
  50. +5
    -5
      types/application.go
  51. +4
    -4
      types/messages.go
  52. +1
    -1
      types/result.go
  53. +133
    -133
      types/types.pb.go
  54. +8
    -8
      types/types.proto

+ 1
- 1
LICENSE View File

@ -1,4 +1,4 @@
Tendermint TMSP
Tendermint ABCI
Copyright (C) 2015 Tendermint Copyright (C) 2015 Tendermint


+ 2
- 2
Makefile View File

@ -2,13 +2,13 @@
all: protoc test install all: protoc test install
NOVENDOR = go list github.com/tendermint/tmsp/... | grep -v /vendor/
NOVENDOR = go list github.com/tendermint/abci/... | grep -v /vendor/
protoc: protoc:
protoc --go_out=plugins=grpc:. types/*.proto protoc --go_out=plugins=grpc:. types/*.proto
install: install:
go install github.com/tendermint/tmsp/cmd/...
go install github.com/tendermint/abci/cmd/...
test: test:
go test `${NOVENDOR}` go test `${NOVENDOR}`


+ 20
- 20
README.md View File

@ -1,37 +1,37 @@
# Tendermint Socket Protocol (TMSP)
# Tendermint Socket Protocol (ABCI)
[![CircleCI](https://circleci.com/gh/tendermint/tmsp.svg?style=svg)](https://circleci.com/gh/tendermint/tmsp)
[![CircleCI](https://circleci.com/gh/tendermint/abci.svg?style=svg)](https://circleci.com/gh/tendermint/abci)
Blockchains are a system for creating shared multi-master application state. Blockchains are a system for creating shared multi-master application state.
**TMSP** is a socket protocol enabling a blockchain consensus engine, running in one process,
**ABCI** is a socket protocol enabling a blockchain consensus engine, running in one process,
to manage a blockchain application state, running in another. to manage a blockchain application state, running in another.
For more information on TMSP, motivations, and tutorials, please visit [our blog post](http://tendermint.com/blog/tmsp-the-tendermint-socket-protocol/).
For more information on ABCI, motivations, and tutorials, please visit [our blog post](http://tendermint.com/blog/abci-the-tendermint-socket-protocol/).
Other implementations: Other implementations:
* [cpp-tmsp](https://github.com/mdyring/cpp-tmsp) by Martin Dyring-Andersen
* [js-tmsp](https://github.com/tendermint/js-tmsp)
* [jTMSP](https://github.com/jTMSP/) for Java
* [cpp-abci](https://github.com/mdyring/cpp-abci) by Martin Dyring-Andersen
* [js-abci](https://github.com/tendermint/js-abci)
* [jABCI](https://github.com/jABCI/) for Java
## Contents ## Contents
This repository holds a number of important pieces: This repository holds a number of important pieces:
- `types/types.proto` - `types/types.proto`
- the protobuf file defining TMSP message types, and the optional grpc interface.
- the protobuf file defining ABCI message types, and the optional grpc interface.
- to build, run `make protoc` - to build, run `make protoc`
- see `protoc --help` and [the grpc docs](https://www.grpc.io/docs) for examples and details of other languages - see `protoc --help` and [the grpc docs](https://www.grpc.io/docs) for examples and details of other languages
- golang implementation of TMSP client and server
- golang implementation of ABCI client and server
- two implementations: - two implementations:
- asynchronous, ordered message passing over unix or tcp; - asynchronous, ordered message passing over unix or tcp;
- messages are serialized using protobuf and length prefixed - messages are serialized using protobuf and length prefixed
- grpc - grpc
- TendermintCore runs a client, and the application runs a server - TendermintCore runs a client, and the application runs a server
- `cmd/tmsp-cli`
- command line tool wrapping the client for probing/testing a TMSP application
- use `tmsp-cli --version` to get the TMSP version
- `cmd/abci-cli`
- command line tool wrapping the client for probing/testing a ABCI application
- use `abci-cli --version` to get the ABCI version
- examples: - examples:
- the `cmd/counter` application, which illustrates nonce checking in txs - the `cmd/counter` application, which illustrates nonce checking in txs
@ -42,15 +42,15 @@ This repository holds a number of important pieces:
Since this is a streaming protocol, all messages are encoded with a length-prefix followed by the message encoded in Protobuf3. Protobuf3 doesn't have an official length-prefix standard, so we use our own. The first byte represents the length of the big-endian encoded length. Since this is a streaming protocol, all messages are encoded with a length-prefix followed by the message encoded in Protobuf3. Protobuf3 doesn't have an official length-prefix standard, so we use our own. The first byte represents the length of the big-endian encoded length.
For example, if the Protobuf3 encoded TMSP message is `0xDEADBEEF` (4 bytes), the length-prefixed message is `0x0104DEADBEEF`. If the Protobuf3 encoded TMSP message is 65535 bytes long, the length-prefixed message would be like `0x02FFFF...`.
For example, if the Protobuf3 encoded ABCI message is `0xDEADBEEF` (4 bytes), the length-prefixed message is `0x0104DEADBEEF`. If the Protobuf3 encoded ABCI message is 65535 bytes long, the length-prefixed message would be like `0x02FFFF...`.
Note this prefixing does not apply for grpc. Note this prefixing does not apply for grpc.
## Message types ## Message types
TMSP requests/responses are simple Protobuf messages. Check out the [schema file](https://github.com/tendermint/tmsp/blob/master/types/types.proto).
ABCI requests/responses are simple Protobuf messages. Check out the [schema file](https://github.com/tendermint/abci/blob/master/types/types.proto).
#### AppendTx
#### DeliverTx
* __Arguments__: * __Arguments__:
* `Data ([]byte)`: The request transaction bytes * `Data ([]byte)`: The request transaction bytes
* __Returns__: * __Returns__:
@ -71,7 +71,7 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil
Validate a mempool transaction, prior to broadcasting or proposing. This message should not mutate the main state, but application Validate a mempool transaction, prior to broadcasting or proposing. This message should not mutate the main state, but application
developers may want to keep a separate CheckTx state that gets reset upon Commit. developers may want to keep a separate CheckTx state that gets reset upon Commit.
CheckTx can happen interspersed with AppendTx, but they happen on different connections - CheckTx from the mempool connection, and AppendTx from the consensus connection. During Commit, the mempool is locked, so you can reset the mempool state to the latest state after running all those appendtxs, and then the mempool will re run whatever txs it has against that latest mempool stte
CheckTx can happen interspersed with DeliverTx, but they happen on different connections - CheckTx from the mempool connection, and DeliverTx from the consensus connection. During Commit, the mempool is locked, so you can reset the mempool state to the latest state after running all those delivertxs, and then the mempool will re run whatever txs it has against that latest mempool stte
Transactions are first run through CheckTx before broadcast to peers in the mempool layer. Transactions are first run through CheckTx before broadcast to peers in the mempool layer.
You can make CheckTx semi-stateful and clear the state upon `Commit` or `BeginBlock`, You can make CheckTx semi-stateful and clear the state upon `Commit` or `BeginBlock`,
@ -122,7 +122,7 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil
* __Arguments__: * __Arguments__:
* `Height (uint64)`: The block height that is starting * `Height (uint64)`: The block height that is starting
* __Usage__:<br/> * __Usage__:<br/>
Signals the beginning of a new block. Called prior to any AppendTxs.
Signals the beginning of a new block. Called prior to any DeliverTxs.
#### EndBlock #### EndBlock
* __Arguments__: * __Arguments__:
@ -148,8 +148,8 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil
##### Jan 23th, 2016 ##### Jan 23th, 2016
* Added CheckTx/Query TMSP message types
* Added Result/Log fields to AppendTx/CheckTx/SetOption
* Added CheckTx/Query ABCI message types
* Added Result/Log fields to DeliverTx/CheckTx/SetOption
* Removed Listener messages * Removed Listener messages
* Removed Code from ResponseSetOption and ResponseGetHash * Removed Code from ResponseSetOption and ResponseGetHash
* Made examples BigEndian * Made examples BigEndian
@ -160,4 +160,4 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil
##### Jan 8th, 2016 ##### Jan 8th, 2016
* Tendermint/TMSP now comes to consensus on the order first before AppendTx.
* Tendermint/ABCI now comes to consensus on the order first before DeliverTx.

+ 5
- 5
client/client.go View File

@ -1,11 +1,11 @@
package tmspcli
package abcicli
import ( import (
"fmt" "fmt"
"sync" "sync"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
type Client interface { type Client interface {
@ -18,7 +18,7 @@ type Client interface {
EchoAsync(msg string) *ReqRes EchoAsync(msg string) *ReqRes
InfoAsync() *ReqRes InfoAsync() *ReqRes
SetOptionAsync(key string, value string) *ReqRes SetOptionAsync(key string, value string) *ReqRes
AppendTxAsync(tx []byte) *ReqRes
DeliverTxAsync(tx []byte) *ReqRes
CheckTxAsync(tx []byte) *ReqRes CheckTxAsync(tx []byte) *ReqRes
QueryAsync(tx []byte) *ReqRes QueryAsync(tx []byte) *ReqRes
CommitAsync() *ReqRes CommitAsync() *ReqRes
@ -27,7 +27,7 @@ type Client interface {
EchoSync(msg string) (res types.Result) EchoSync(msg string) (res types.Result)
InfoSync() (resInfo types.ResponseInfo, err error) InfoSync() (resInfo types.ResponseInfo, err error)
SetOptionSync(key string, value string) (res types.Result) SetOptionSync(key string, value string) (res types.Result)
AppendTxSync(tx []byte) (res types.Result)
DeliverTxSync(tx []byte) (res types.Result)
CheckTxSync(tx []byte) (res types.Result) CheckTxSync(tx []byte) (res types.Result)
QuerySync(tx []byte) (res types.Result) QuerySync(tx []byte) (res types.Result)
CommitSync() (res types.Result) CommitSync() (res types.Result)
@ -50,7 +50,7 @@ func NewClient(addr, transport string, mustConnect bool) (client Client, err err
case "grpc": case "grpc":
client, err = NewGRPCClient(addr, mustConnect) client, err = NewGRPCClient(addr, mustConnect)
default: default:
err = fmt.Errorf("Unknown tmsp transport %s", transport)
err = fmt.Errorf("Unknown abci transport %s", transport)
} }
return return


+ 13
- 13
client/grpc_client.go View File

@ -1,4 +1,4 @@
package tmspcli
package abcicli
import ( import (
"net" "net"
@ -9,7 +9,7 @@ import (
grpc "google.golang.org/grpc" grpc "google.golang.org/grpc"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
// A stripped copy of the remoteClient that makes // A stripped copy of the remoteClient that makes
@ -18,7 +18,7 @@ type grpcClient struct {
BaseService BaseService
mustConnect bool mustConnect bool
client types.TMSPApplicationClient
client types.ABCIApplicationClient
mtx sync.Mutex mtx sync.Mutex
addr string addr string
@ -50,13 +50,13 @@ RETRY_LOOP:
if cli.mustConnect { if cli.mustConnect {
return err return err
} else { } else {
log.Warn(Fmt("tmsp.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
log.Warn(Fmt("abci.grpcClient failed to connect to %v. Retrying...\n", cli.addr))
time.Sleep(time.Second * 3) time.Sleep(time.Second * 3)
continue RETRY_LOOP continue RETRY_LOOP
} }
} }
client := types.NewTMSPApplicationClient(conn)
client := types.NewABCIApplicationClient(conn)
ENSURE_CONNECTED: ENSURE_CONNECTED:
for { for {
@ -93,7 +93,7 @@ func (cli *grpcClient) StopForError(err error) {
} }
cli.mtx.Unlock() cli.mtx.Unlock()
log.Warn(Fmt("Stopping tmsp.grpcClient for error: %v", err.Error()))
log.Warn(Fmt("Stopping abci.grpcClient for error: %v", err.Error()))
cli.Stop() cli.Stop()
} }
@ -155,13 +155,13 @@ func (cli *grpcClient) SetOptionAsync(key string, value string) *ReqRes {
return cli.finishAsyncCall(req, &types.Response{&types.Response_SetOption{res}}) return cli.finishAsyncCall(req, &types.Response{&types.Response_SetOption{res}})
} }
func (cli *grpcClient) AppendTxAsync(tx []byte) *ReqRes {
req := types.ToRequestAppendTx(tx)
res, err := cli.client.AppendTx(context.Background(), req.GetAppendTx(), grpc.FailFast(true))
func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes {
req := types.ToRequestDeliverTx(tx)
res, err := cli.client.DeliverTx(context.Background(), req.GetDeliverTx(), grpc.FailFast(true))
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_AppendTx{res}})
return cli.finishAsyncCall(req, &types.Response{&types.Response_DeliverTx{res}})
} }
func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes { func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
@ -283,12 +283,12 @@ func (cli *grpcClient) SetOptionSync(key string, value string) (res types.Result
return types.Result{Code: OK, Data: nil, Log: resp.Log} return types.Result{Code: OK, Data: nil, Log: resp.Log}
} }
func (cli *grpcClient) AppendTxSync(tx []byte) (res types.Result) {
reqres := cli.AppendTxAsync(tx)
func (cli *grpcClient) DeliverTxSync(tx []byte) (res types.Result) {
reqres := cli.DeliverTxAsync(tx)
if res := cli.checkErrGetResult(); res.IsErr() { if res := cli.checkErrGetResult(); res.IsErr() {
return res return res
} }
resp := reqres.Response.GetAppendTx()
resp := reqres.Response.GetDeliverTx()
return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log} return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log}
} }


+ 8
- 8
client/local_client.go View File

@ -1,10 +1,10 @@
package tmspcli
package abcicli
import ( import (
"sync" "sync"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
types "github.com/tendermint/tmsp/types"
types "github.com/tendermint/abci/types"
) )
type localClient struct { type localClient struct {
@ -69,13 +69,13 @@ func (app *localClient) SetOptionAsync(key string, value string) *ReqRes {
) )
} }
func (app *localClient) AppendTxAsync(tx []byte) *ReqRes {
func (app *localClient) DeliverTxAsync(tx []byte) *ReqRes {
app.mtx.Lock() app.mtx.Lock()
res := app.Application.AppendTx(tx)
res := app.Application.DeliverTx(tx)
app.mtx.Unlock() app.mtx.Unlock()
return app.callback( return app.callback(
types.ToRequestAppendTx(tx),
types.ToResponseAppendTx(res.Code, res.Data, res.Log),
types.ToRequestDeliverTx(tx),
types.ToResponseDeliverTx(res.Code, res.Data, res.Log),
) )
} }
@ -171,9 +171,9 @@ func (app *localClient) SetOptionSync(key string, value string) (res types.Resul
return types.OK.SetLog(log) return types.OK.SetLog(log)
} }
func (app *localClient) AppendTxSync(tx []byte) (res types.Result) {
func (app *localClient) DeliverTxSync(tx []byte) (res types.Result) {
app.mtx.Lock() app.mtx.Lock()
res = app.Application.AppendTx(tx)
res = app.Application.DeliverTx(tx)
app.mtx.Unlock() app.mtx.Unlock()
return res return res
} }


+ 2
- 2
client/log.go View File

@ -1,7 +1,7 @@
package tmspcli
package abcicli
import ( import (
"github.com/tendermint/go-logger" "github.com/tendermint/go-logger"
) )
var log = logger.New("module", "tmspcli")
var log = logger.New("module", "abcicli")

+ 11
- 11
client/socket_client.go View File

@ -1,4 +1,4 @@
package tmspcli
package abcicli
import ( import (
"bufio" "bufio"
@ -11,7 +11,7 @@ import (
"time" "time"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
const ( const (
@ -70,7 +70,7 @@ RETRY_LOOP:
if cli.mustConnect { if cli.mustConnect {
return err return err
} else { } else {
log.Warn(Fmt("tmsp.socketClient failed to connect to %v. Retrying...", cli.addr))
log.Warn(Fmt("abci.socketClient failed to connect to %v. Retrying...", cli.addr))
time.Sleep(time.Second * 3) time.Sleep(time.Second * 3)
continue RETRY_LOOP continue RETRY_LOOP
} }
@ -109,7 +109,7 @@ func (cli *socketClient) StopForError(err error) {
} }
cli.mtx.Unlock() cli.mtx.Unlock()
log.Warn(Fmt("Stopping tmsp.socketClient for error: %v", err.Error()))
log.Warn(Fmt("Stopping abci.socketClient for error: %v", err.Error()))
cli.Stop() cli.Stop()
} }
@ -243,8 +243,8 @@ func (cli *socketClient) SetOptionAsync(key string, value string) *ReqRes {
return cli.queueRequest(types.ToRequestSetOption(key, value)) return cli.queueRequest(types.ToRequestSetOption(key, value))
} }
func (cli *socketClient) AppendTxAsync(tx []byte) *ReqRes {
return cli.queueRequest(types.ToRequestAppendTx(tx))
func (cli *socketClient) DeliverTxAsync(tx []byte) *ReqRes {
return cli.queueRequest(types.ToRequestDeliverTx(tx))
} }
func (cli *socketClient) CheckTxAsync(tx []byte) *ReqRes { func (cli *socketClient) CheckTxAsync(tx []byte) *ReqRes {
@ -315,13 +315,13 @@ func (cli *socketClient) SetOptionSync(key string, value string) (res types.Resu
return types.Result{Code: OK, Data: nil, Log: resp.Log} return types.Result{Code: OK, Data: nil, Log: resp.Log}
} }
func (cli *socketClient) AppendTxSync(tx []byte) (res types.Result) {
reqres := cli.queueRequest(types.ToRequestAppendTx(tx))
func (cli *socketClient) DeliverTxSync(tx []byte) (res types.Result) {
reqres := cli.queueRequest(types.ToRequestDeliverTx(tx))
cli.FlushSync() cli.FlushSync()
if err := cli.Error(); err != nil { if err := cli.Error(); err != nil {
return types.ErrInternalError.SetLog(err.Error()) return types.ErrInternalError.SetLog(err.Error())
} }
resp := reqres.Response.GetAppendTx()
resp := reqres.Response.GetDeliverTx()
return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log} return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log}
} }
@ -429,8 +429,8 @@ func resMatchesReq(req *types.Request, res *types.Response) (ok bool) {
_, ok = res.Value.(*types.Response_Info) _, ok = res.Value.(*types.Response_Info)
case *types.Request_SetOption: case *types.Request_SetOption:
_, ok = res.Value.(*types.Response_SetOption) _, ok = res.Value.(*types.Response_SetOption)
case *types.Request_AppendTx:
_, ok = res.Value.(*types.Response_AppendTx)
case *types.Request_DeliverTx:
_, ok = res.Value.(*types.Response_DeliverTx)
case *types.Request_CheckTx: case *types.Request_CheckTx:
_, ok = res.Value.(*types.Response_CheckTx) _, ok = res.Value.(*types.Response_CheckTx)
case *types.Request_Commit: case *types.Request_Commit:


cmd/tmsp-cli/tmsp-cli.go → cmd/abci-cli/tmsp-cli.go View File


+ 4
- 4
cmd/counter/main.go View File

@ -4,20 +4,20 @@ import (
"flag" "flag"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/example/counter"
"github.com/tendermint/tmsp/server"
"github.com/tendermint/abci/example/counter"
"github.com/tendermint/abci/server"
) )
func main() { func main() {
addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address") addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address")
tmspPtr := flag.String("tmsp", "socket", "TMSP server: socket | grpc")
abciPtr := flag.String("abci", "socket", "ABCI server: socket | grpc")
serialPtr := flag.Bool("serial", false, "Enforce incrementing (serial) txs") serialPtr := flag.Bool("serial", false, "Enforce incrementing (serial) txs")
flag.Parse() flag.Parse()
app := counter.NewCounterApplication(*serialPtr) app := counter.NewCounterApplication(*serialPtr)
// Start the listener // Start the listener
srv, err := server.NewServer(*addrPtr, *tmspPtr, app)
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
if err != nil { if err != nil {
Exit(err.Error()) Exit(err.Error())
} }


+ 5
- 5
cmd/dummy/main.go View File

@ -4,15 +4,15 @@ import (
"flag" "flag"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/example/dummy"
"github.com/tendermint/tmsp/server"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/example/dummy"
"github.com/tendermint/abci/server"
"github.com/tendermint/abci/types"
) )
func main() { func main() {
addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address") addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address")
tmspPtr := flag.String("tmsp", "socket", "socket | grpc")
abciPtr := flag.String("abci", "socket", "socket | grpc")
persistencePtr := flag.String("persist", "", "directory to use for a database") persistencePtr := flag.String("persist", "", "directory to use for a database")
flag.Parse() flag.Parse()
@ -25,7 +25,7 @@ func main() {
} }
// Start the listener // Start the listener
srv, err := server.NewServer(*addrPtr, *tmspPtr, app)
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
if err != nil { if err != nil {
Exit(err.Error()) Exit(err.Error())
} }


+ 5
- 5
example/chain_aware/chain_aware_app.go View File

@ -4,18 +4,18 @@ import (
"flag" "flag"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/server"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/server"
"github.com/tendermint/abci/types"
) )
func main() { func main() {
addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address") addrPtr := flag.String("addr", "tcp://0.0.0.0:46658", "Listen address")
tmspPtr := flag.String("tmsp", "socket", "socket | grpc")
abciPtr := flag.String("abci", "socket", "socket | grpc")
flag.Parse() flag.Parse()
// Start the listener // Start the listener
srv, err := server.NewServer(*addrPtr, *tmspPtr, NewChainAwareApplication())
srv, err := server.NewServer(*addrPtr, *abciPtr, NewChainAwareApplication())
if err != nil { if err != nil {
Exit(err.Error()) Exit(err.Error())
} }
@ -45,7 +45,7 @@ func (app *ChainAwareApplication) SetOption(key string, value string) (log strin
return "" return ""
} }
func (app *ChainAwareApplication) AppendTx(tx []byte) types.Result {
func (app *ChainAwareApplication) DeliverTx(tx []byte) types.Result {
return types.NewResultOK(nil, "") return types.NewResultOK(nil, "")
} }


+ 4
- 4
example/chain_aware/chain_aware_test.go View File

@ -6,9 +6,9 @@ import (
"testing" "testing"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/client"
"github.com/tendermint/tmsp/server"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/client"
"github.com/tendermint/abci/server"
"github.com/tendermint/abci/types"
) )
func TestChainAware(t *testing.T) { func TestChainAware(t *testing.T) {
@ -23,7 +23,7 @@ func TestChainAware(t *testing.T) {
defer srv.Stop() defer srv.Stop()
// Connect to the socket // Connect to the socket
client, err := tmspcli.NewSocketClient("unix://test.sock", false)
client, err := abcicli.NewSocketClient("unix://test.sock", false)
if err != nil { if err != nil {
Exit(Fmt("Error starting socket client: %v", err.Error())) Exit(Fmt("Error starting socket client: %v", err.Error()))
} }


+ 2
- 2
example/counter/counter.go View File

@ -4,7 +4,7 @@ import (
"encoding/binary" "encoding/binary"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
type CounterApplication struct { type CounterApplication struct {
@ -28,7 +28,7 @@ func (app *CounterApplication) SetOption(key string, value string) (log string)
return "" return ""
} }
func (app *CounterApplication) AppendTx(tx []byte) types.Result {
func (app *CounterApplication) DeliverTx(tx []byte) types.Result {
if app.serial { if app.serial {
if len(tx) > 8 { if len(tx) > 8 {
return types.ErrEncodingError.SetLog(Fmt("Max tx size is 8 bytes, got %d", len(tx))) return types.ErrEncodingError.SetLog(Fmt("Max tx size is 8 bytes, got %d", len(tx)))


+ 1
- 1
example/dummy/README.md View File

@ -14,7 +14,7 @@ The app has no replay protection (other than what the mempool provides).
The PersistentDummyApplication wraps the DummyApplication The PersistentDummyApplication wraps the DummyApplication
and provides two additional features: and provides two additional features:
1) persistence of state across app restarts (using Tendermint's TMSP-Handshake mechanism)
1) persistence of state across app restarts (using Tendermint's ABCI-Handshake mechanism)
2) validator set changes 2) validator set changes
The state is persisted in leveldb along with the last block committed, The state is persisted in leveldb along with the last block committed,


+ 2
- 2
example/dummy/dummy.go View File

@ -7,7 +7,7 @@ import (
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/go-merkle" "github.com/tendermint/go-merkle"
"github.com/tendermint/go-wire" "github.com/tendermint/go-wire"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
type DummyApplication struct { type DummyApplication struct {
@ -28,7 +28,7 @@ func (app *DummyApplication) SetOption(key string, value string) (log string) {
} }
// tx is either "key=value" or just arbitrary bytes // tx is either "key=value" or just arbitrary bytes
func (app *DummyApplication) AppendTx(tx []byte) types.Result {
func (app *DummyApplication) DeliverTx(tx []byte) types.Result {
parts := strings.Split(string(tx), "=") parts := strings.Split(string(tx), "=")
if len(parts) == 2 { if len(parts) == 2 {
app.state.Set([]byte(parts[0]), []byte(parts[1])) app.state.Set([]byte(parts[0]), []byte(parts[1]))


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

@ -9,14 +9,14 @@ import (
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/go-crypto" "github.com/tendermint/go-crypto"
"github.com/tendermint/go-wire" "github.com/tendermint/go-wire"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
func testDummy(t *testing.T, dummy types.Application, tx []byte, key, value string) { func testDummy(t *testing.T, dummy types.Application, tx []byte, key, value string) {
if r := dummy.AppendTx(tx); r.IsErr() {
if r := dummy.DeliverTx(tx); r.IsErr() {
t.Fatal(r) t.Fatal(r)
} }
if r := dummy.AppendTx(tx); r.IsErr() {
if r := dummy.DeliverTx(tx); r.IsErr() {
t.Fatal(r) t.Fatal(r)
} }
@ -49,7 +49,7 @@ func TestDummyKV(t *testing.T) {
} }
func TestPersistentDummyKV(t *testing.T) { func TestPersistentDummyKV(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "tmsp-dummy-test") // TODO
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -65,7 +65,7 @@ func TestPersistentDummyKV(t *testing.T) {
} }
func TestPersistentDummyInfo(t *testing.T) { func TestPersistentDummyInfo(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "tmsp-dummy-test") // TODO
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -96,7 +96,7 @@ func TestPersistentDummyInfo(t *testing.T) {
// add a validator, remove a validator, update a validator // add a validator, remove a validator, update a validator
func TestValSetChanges(t *testing.T) { func TestValSetChanges(t *testing.T) {
dir, err := ioutil.TempDir("/tmp", "tmsp-dummy-test") // TODO
dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -175,7 +175,7 @@ func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff [
dummyChain := dummy.(types.BlockchainAware) // hmm... dummyChain := dummy.(types.BlockchainAware) // hmm...
dummyChain.BeginBlock(hash, header) dummyChain.BeginBlock(hash, header)
for _, tx := range txs { for _, tx := range txs {
if r := dummy.AppendTx(tx); r.IsErr() {
if r := dummy.DeliverTx(tx); r.IsErr() {
t.Fatal(r) t.Fatal(r)
} }
} }


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

@ -10,7 +10,7 @@ import (
dbm "github.com/tendermint/go-db" dbm "github.com/tendermint/go-db"
"github.com/tendermint/go-merkle" "github.com/tendermint/go-merkle"
"github.com/tendermint/go-wire" "github.com/tendermint/go-wire"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
const ( const (
@ -59,7 +59,7 @@ func (app *PersistentDummyApplication) SetOption(key string, value string) (log
} }
// tx is either "key=value" or just arbitrary bytes // tx is either "key=value" or just arbitrary bytes
func (app *PersistentDummyApplication) AppendTx(tx []byte) types.Result {
func (app *PersistentDummyApplication) DeliverTx(tx []byte) types.Result {
// if it starts with "val:", update the validator set // if it starts with "val:", update the validator set
// format is "val:pubkey/power" // format is "val:pubkey/power"
if isValidatorTx(tx) { if isValidatorTx(tx) {
@ -69,7 +69,7 @@ func (app *PersistentDummyApplication) AppendTx(tx []byte) types.Result {
} }
// otherwise, update the key-value store // otherwise, update the key-value store
return app.app.AppendTx(tx)
return app.app.DeliverTx(tx)
} }
func (app *PersistentDummyApplication) CheckTx(tx []byte) types.Result { func (app *PersistentDummyApplication) CheckTx(tx []byte) types.Result {


+ 24
- 24
example/example_test.go View File

@ -11,11 +11,11 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/client"
"github.com/tendermint/tmsp/example/dummy"
nilapp "github.com/tendermint/tmsp/example/nil"
"github.com/tendermint/tmsp/server"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/client"
"github.com/tendermint/abci/example/dummy"
nilapp "github.com/tendermint/abci/example/nil"
"github.com/tendermint/abci/server"
"github.com/tendermint/abci/types"
) )
func TestDummy(t *testing.T) { func TestDummy(t *testing.T) {
@ -35,7 +35,7 @@ func TestGRPC(t *testing.T) {
func testStream(t *testing.T, app types.Application) { func testStream(t *testing.T, app types.Application) {
numAppendTxs := 200000
numDeliverTxs := 200000
// Start the listener // Start the listener
server, err := server.NewSocketServer("unix://test.sock", app) server, err := server.NewSocketServer("unix://test.sock", app)
@ -45,7 +45,7 @@ func testStream(t *testing.T, app types.Application) {
defer server.Stop() defer server.Stop()
// Connect to the socket // Connect to the socket
client, err := tmspcli.NewSocketClient("unix://test.sock", false)
client, err := abcicli.NewSocketClient("unix://test.sock", false)
if err != nil { if err != nil {
Exit(Fmt("Error starting socket client: %v", err.Error())) Exit(Fmt("Error starting socket client: %v", err.Error()))
} }
@ -57,15 +57,15 @@ func testStream(t *testing.T, app types.Application) {
client.SetResponseCallback(func(req *types.Request, res *types.Response) { client.SetResponseCallback(func(req *types.Request, res *types.Response) {
// Process response // Process response
switch r := res.Value.(type) { switch r := res.Value.(type) {
case *types.Response_AppendTx:
case *types.Response_DeliverTx:
counter += 1 counter += 1
if r.AppendTx.Code != types.CodeType_OK {
t.Error("AppendTx failed with ret_code", r.AppendTx.Code)
if r.DeliverTx.Code != types.CodeType_OK {
t.Error("DeliverTx failed with ret_code", r.DeliverTx.Code)
} }
if counter > numAppendTxs {
t.Fatalf("Too many AppendTx responses. Got %d, expected %d", counter, numAppendTxs)
if counter > numDeliverTxs {
t.Fatalf("Too many DeliverTx responses. Got %d, expected %d", counter, numDeliverTxs)
} }
if counter == numAppendTxs {
if counter == numDeliverTxs {
go func() { go func() {
time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow
close(done) close(done)
@ -80,9 +80,9 @@ func testStream(t *testing.T, app types.Application) {
}) })
// Write requests // Write requests
for counter := 0; counter < numAppendTxs; counter++ {
for counter := 0; counter < numDeliverTxs; counter++ {
// Send request // Send request
reqRes := client.AppendTxAsync([]byte("test"))
reqRes := client.DeliverTxAsync([]byte("test"))
_ = reqRes _ = reqRes
// check err ? // check err ?
@ -108,7 +108,7 @@ func dialerFunc(addr string, timeout time.Duration) (net.Conn, error) {
func testGRPCSync(t *testing.T, app *types.GRPCApplication) { func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
numAppendTxs := 2000
numDeliverTxs := 2000
// Start the listener // Start the listener
server, err := server.NewGRPCServer("unix://test.sock", app) server, err := server.NewGRPCServer("unix://test.sock", app)
@ -124,24 +124,24 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
} }
defer conn.Close() defer conn.Close()
client := types.NewTMSPApplicationClient(conn)
client := types.NewABCIApplicationClient(conn)
// Write requests // Write requests
for counter := 0; counter < numAppendTxs; counter++ {
for counter := 0; counter < numDeliverTxs; counter++ {
// Send request // Send request
response, err := client.AppendTx(context.Background(), &types.RequestAppendTx{[]byte("test")})
response, err := client.DeliverTx(context.Background(), &types.RequestDeliverTx{[]byte("test")})
if err != nil { if err != nil {
t.Fatalf("Error in GRPC AppendTx: %v", err.Error())
t.Fatalf("Error in GRPC DeliverTx: %v", err.Error())
} }
counter += 1 counter += 1
if response.Code != types.CodeType_OK { if response.Code != types.CodeType_OK {
t.Error("AppendTx failed with ret_code", response.Code)
t.Error("DeliverTx failed with ret_code", response.Code)
} }
if counter > numAppendTxs {
t.Fatal("Too many AppendTx responses")
if counter > numDeliverTxs {
t.Fatal("Too many DeliverTx responses")
} }
t.Log("response", counter) t.Log("response", counter)
if counter == numAppendTxs {
if counter == numDeliverTxs {
go func() { go func() {
time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow time.Sleep(time.Second * 2) // Wait for a bit to allow counter overflow
}() }()


+ 1
- 1
example/js/README.md View File

@ -1 +1 @@
This example has been moved here: https://github.com/tendermint/js-tmsp/tree/master/example
This example has been moved here: https://github.com/tendermint/js-abci/tree/master/example

+ 2
- 2
example/nil/nil_app.go View File

@ -1,7 +1,7 @@
package nilapp package nilapp
import ( import (
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
type NilApplication struct { type NilApplication struct {
@ -19,7 +19,7 @@ func (app *NilApplication) SetOption(key string, value string) (log string) {
return "" return ""
} }
func (app *NilApplication) AppendTx(tx []byte) types.Result {
func (app *NilApplication) DeliverTx(tx []byte) types.Result {
return types.NewResultOK(nil, "") return types.NewResultOK(nil, "")
} }


example/python/tmsp/__init__.py → example/python/abci/__init__.py View File


example/python/tmsp/msg.py → example/python/abci/msg.py View File


example/python/tmsp/reader.py → example/python/abci/reader.py View File


example/python/tmsp/server.py → example/python/abci/server.py View File


example/python/tmsp/wire.py → example/python/abci/wire.py View File


+ 6
- 6
example/python/app.py View File

@ -1,8 +1,8 @@
import sys import sys
from tmsp.wire import hex2bytes, decode_big_endian, encode_big_endian
from tmsp.server import TMSPServer
from tmsp.reader import BytesBuffer
from abci.wire import hex2bytes, decode_big_endian, encode_big_endian
from abci.server import ABCIServer
from abci.reader import BytesBuffer
class CounterApplication(): class CounterApplication():
@ -24,7 +24,7 @@ class CounterApplication():
self.serial = True self.serial = True
return 0 return 0
def append_tx(self, txBytes):
def deliver_tx(self, txBytes):
if self.serial: if self.serial:
txByteArray = bytearray(txBytes) txByteArray = bytearray(txBytes)
if len(txBytes) >= 2 and txBytes[:2] == "0x": if len(txBytes) >= 2 and txBytes[:2] == "0x":
@ -75,8 +75,8 @@ if __name__ == '__main__':
print "too many arguments" print "too many arguments"
quit() quit()
print 'TMSP Demo APP (Python)'
print 'ABCI Demo APP (Python)'
app = CounterApplication() app = CounterApplication()
server = TMSPServer(app, port)
server = ABCIServer(app, port)
server.main_loop() server.main_loop()

example/python3/tmsp/__init__.py → example/python3/abci/__init__.py View File


example/python3/tmsp/msg.py → example/python3/abci/msg.py View File


example/python3/tmsp/reader.py → example/python3/abci/reader.py View File


example/python3/tmsp/server.py → example/python3/abci/server.py View File


example/python3/tmsp/wire.py → example/python3/abci/wire.py View File


+ 6
- 6
example/python3/app.py View File

@ -1,8 +1,8 @@
import sys import sys
from tmsp.wire import hex2bytes, decode_big_endian, encode_big_endian
from tmsp.server import TMSPServer
from tmsp.reader import BytesBuffer
from abci.wire import hex2bytes, decode_big_endian, encode_big_endian
from abci.server import ABCIServer
from abci.reader import BytesBuffer
class CounterApplication(): class CounterApplication():
@ -24,7 +24,7 @@ class CounterApplication():
self.serial = True self.serial = True
return 0 return 0
def append_tx(self, txBytes):
def deliver_tx(self, txBytes):
if self.serial: if self.serial:
txByteArray = bytearray(txBytes) txByteArray = bytearray(txBytes)
if len(txBytes) >= 2 and txBytes[:2] == "0x": if len(txBytes) >= 2 and txBytes[:2] == "0x":
@ -75,8 +75,8 @@ if __name__ == '__main__':
print("too many arguments") print("too many arguments")
quit() quit()
print('TMSP Demo APP (Python)')
print('ABCI Demo APP (Python)')
app = CounterApplication() app = CounterApplication()
server = TMSPServer(app, port)
server = ABCIServer(app, port)
server.main_loop() server.main_loop()

+ 1
- 1
glide.yaml View File

@ -1,4 +1,4 @@
package: github.com/tendermint/tmsp
package: github.com/tendermint/abci
import: import:
- package: github.com/golang/protobuf - package: github.com/golang/protobuf
subpackages: subpackages:


+ 5
- 5
server/grpc_server.go View File

@ -7,7 +7,7 @@ import (
"google.golang.org/grpc" "google.golang.org/grpc"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
// var maxNumberConnections = 2 // var maxNumberConnections = 2
@ -20,10 +20,10 @@ type GRPCServer struct {
listener net.Listener listener net.Listener
server *grpc.Server server *grpc.Server
app types.TMSPApplicationServer
app types.ABCIApplicationServer
} }
func NewGRPCServer(protoAddr string, app types.TMSPApplicationServer) (Service, error) {
func NewGRPCServer(protoAddr string, app types.ABCIApplicationServer) (Service, error) {
parts := strings.SplitN(protoAddr, "://", 2) parts := strings.SplitN(protoAddr, "://", 2)
proto, addr := parts[0], parts[1] proto, addr := parts[0], parts[1]
s := &GRPCServer{ s := &GRPCServer{
@ -32,7 +32,7 @@ func NewGRPCServer(protoAddr string, app types.TMSPApplicationServer) (Service,
listener: nil, listener: nil,
app: app, app: app,
} }
s.BaseService = *NewBaseService(nil, "TMSPServer", s)
s.BaseService = *NewBaseService(nil, "ABCIServer", s)
_, err := s.Start() // Just start it _, err := s.Start() // Just start it
return s, err return s, err
} }
@ -45,7 +45,7 @@ func (s *GRPCServer) OnStart() error {
} }
s.listener = ln s.listener = ln
s.server = grpc.NewServer() s.server = grpc.NewServer()
types.RegisterTMSPApplicationServer(s.server, s.app)
types.RegisterABCIApplicationServer(s.server, s.app)
go s.server.Serve(s.listener) go s.server.Serve(s.listener)
return nil return nil
} }


+ 1
- 1
server/log.go View File

@ -4,4 +4,4 @@ import (
"github.com/tendermint/go-logger" "github.com/tendermint/go-logger"
) )
var log = logger.New("module", "tmsp-server")
var log = logger.New("module", "abci-server")

+ 1
- 1
server/server.go View File

@ -4,7 +4,7 @@ import (
"fmt" "fmt"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
func NewServer(protoAddr, transport string, app types.Application) (Service, error) { func NewServer(protoAddr, transport string, app types.Application) (Service, error) {


+ 5
- 5
server/socket_server.go View File

@ -9,7 +9,7 @@ import (
"sync" "sync"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
// var maxNumberConnections = 2 // var maxNumberConnections = 2
@ -39,7 +39,7 @@ func NewSocketServer(protoAddr string, app types.Application) (Service, error) {
app: app, app: app,
conns: make(map[int]net.Conn), conns: make(map[int]net.Conn),
} }
s.BaseService = *NewBaseService(nil, "TMSPServer", s)
s.BaseService = *NewBaseService(nil, "ABCIServer", s)
_, err := s.Start() // Just start it _, err := s.Start() // Just start it
return s, err return s, err
} }
@ -174,9 +174,9 @@ func (s *SocketServer) handleRequest(req *types.Request, responses chan<- *types
so := r.SetOption so := r.SetOption
logStr := s.app.SetOption(so.Key, so.Value) logStr := s.app.SetOption(so.Key, so.Value)
responses <- types.ToResponseSetOption(logStr) responses <- types.ToResponseSetOption(logStr)
case *types.Request_AppendTx:
res := s.app.AppendTx(r.AppendTx.Tx)
responses <- types.ToResponseAppendTx(res.Code, res.Data, res.Log)
case *types.Request_DeliverTx:
res := s.app.DeliverTx(r.DeliverTx.Tx)
responses <- types.ToResponseDeliverTx(res.Code, res.Data, res.Log)
case *types.Request_CheckTx: case *types.Request_CheckTx:
res := s.app.CheckTx(r.CheckTx.Tx) res := s.app.CheckTx(r.CheckTx.Tx)
responses <- types.ToResponseCheckTx(res.Code, res.Data, res.Log) responses <- types.ToResponseCheckTx(res.Code, res.Data, res.Log)


+ 1
- 1
tests/benchmarks/parallel/parallel.go View File

@ -6,7 +6,7 @@ import (
//"encoding/hex" //"encoding/hex"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
func main() { func main() {


+ 1
- 1
tests/benchmarks/simple/simple.go View File

@ -9,7 +9,7 @@ import (
//"encoding/hex" //"encoding/hex"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
func main() { func main() {


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

@ -7,24 +7,24 @@ import (
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
"github.com/tendermint/go-process" "github.com/tendermint/go-process"
"github.com/tendermint/tmsp/client"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/client"
"github.com/tendermint/abci/types"
) )
//---------------------------------------- //----------------------------------------
func StartApp(tmspApp string) *process.Process {
func StartApp(abciApp string) *process.Process {
// Start the app // Start the app
//outBuf := NewBufferCloser(nil) //outBuf := NewBufferCloser(nil)
proc, err := process.StartProcess("tmsp_app",
proc, err := process.StartProcess("abci_app",
"", "",
"bash", "bash",
[]string{"-c", tmspApp},
[]string{"-c", abciApp},
nil, nil,
os.Stdout, os.Stdout,
) )
if err != nil { if err != nil {
panic("running tmsp_app: " + err.Error())
panic("running abci_app: " + err.Error())
} }
// TODO a better way to handle this? // TODO a better way to handle this?
@ -33,16 +33,16 @@ func StartApp(tmspApp string) *process.Process {
return proc return proc
} }
func StartClient(tmspType string) tmspcli.Client {
func StartClient(abciType string) abcicli.Client {
// Start client // Start client
client, err := tmspcli.NewClient("tcp://127.0.0.1:46658", tmspType, true)
client, err := abcicli.NewClient("tcp://127.0.0.1:46658", abciType, true)
if err != nil { if err != nil {
panic("connecting to tmsp_app: " + err.Error())
panic("connecting to abci_app: " + err.Error())
} }
return client return client
} }
func SetOption(client tmspcli.Client, key, value string) {
func SetOption(client abcicli.Client, key, value string) {
res := client.SetOptionSync(key, value) res := client.SetOptionSync(key, value)
_, _, log := res.Code, res.Data, res.Log _, _, log := res.Code, res.Data, res.Log
if res.IsErr() { if res.IsErr() {
@ -50,7 +50,7 @@ func SetOption(client tmspcli.Client, key, value string) {
} }
} }
func Commit(client tmspcli.Client, hashExp []byte) {
func Commit(client abcicli.Client, hashExp []byte) {
res := client.CommitSync() res := client.CommitSync()
_, data, log := res.Code, res.Data, res.Log _, data, log := res.Code, res.Data, res.Log
if res.IsErr() { if res.IsErr() {
@ -62,20 +62,20 @@ func Commit(client tmspcli.Client, hashExp []byte) {
} }
} }
func AppendTx(client tmspcli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
res := client.AppendTxSync(txBytes)
func DeliverTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
res := client.DeliverTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log code, data, log := res.Code, res.Data, res.Log
if code != codeExp { if code != codeExp {
panic(Fmt("AppendTx response code was unexpected. Got %v expected %v. Log: %v",
panic(Fmt("DeliverTx response code was unexpected. Got %v expected %v. Log: %v",
code, codeExp, log)) code, codeExp, log))
} }
if !bytes.Equal(data, dataExp) { if !bytes.Equal(data, dataExp) {
panic(Fmt("AppendTx response data was unexpected. Got %X expected %X",
panic(Fmt("DeliverTx response data was unexpected. Got %X expected %X",
data, dataExp)) data, dataExp))
} }
} }
func CheckTx(client tmspcli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
func CheckTx(client abcicli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
res := client.CheckTxSync(txBytes) res := client.CheckTxSync(txBytes)
code, data, log := res.Code, res.Data, res.Log code, data, log := res.Code, res.Data, res.Log
if res.IsErr() { if res.IsErr() {


+ 19
- 19
tests/test_app/main.go View File

@ -4,15 +4,15 @@ import (
"fmt" "fmt"
"os" "os"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
var tmspType string
var abciType string
func init() { func init() {
tmspType = os.Getenv("TMSP")
if tmspType == "" {
tmspType = "socket"
abciType = os.Getenv("ABCI")
if abciType == "" {
abciType = "socket"
} }
} }
@ -21,28 +21,28 @@ func main() {
} }
func testCounter() { func testCounter() {
tmspApp := os.Getenv("TMSP_APP")
if tmspApp == "" {
panic("No TMSP_APP specified")
abciApp := os.Getenv("ABCI_APP")
if abciApp == "" {
panic("No ABCI_APP specified")
} }
fmt.Printf("Running %s test with tmsp=%s\n", tmspApp, tmspType)
appProc := StartApp(tmspApp)
fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType)
appProc := StartApp(abciApp)
defer appProc.StopProcess(true) defer appProc.StopProcess(true)
client := StartClient(tmspType)
client := StartClient(abciType)
defer client.Stop() defer client.Stop()
SetOption(client, "serial", "on") SetOption(client, "serial", "on")
Commit(client, nil) Commit(client, nil)
AppendTx(client, []byte("abc"), types.CodeType_BadNonce, nil)
DeliverTx(client, []byte("abc"), types.CodeType_BadNonce, nil)
Commit(client, nil) Commit(client, nil)
AppendTx(client, []byte{0x00}, types.CodeType_OK, nil)
DeliverTx(client, []byte{0x00}, types.CodeType_OK, nil)
Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1}) Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 1})
AppendTx(client, []byte{0x00}, types.CodeType_BadNonce, nil)
AppendTx(client, []byte{0x01}, types.CodeType_OK, nil)
AppendTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil)
AppendTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil)
AppendTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil)
AppendTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil)
DeliverTx(client, []byte{0x00}, types.CodeType_BadNonce, nil)
DeliverTx(client, []byte{0x01}, types.CodeType_OK, nil)
DeliverTx(client, []byte{0x00, 0x02}, types.CodeType_OK, nil)
DeliverTx(client, []byte{0x00, 0x03}, types.CodeType_OK, nil)
DeliverTx(client, []byte{0x00, 0x00, 0x04}, types.CodeType_OK, nil)
DeliverTx(client, []byte{0x00, 0x00, 0x06}, types.CodeType_BadNonce, nil)
Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5}) Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5})
} }

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

@ -1,17 +1,17 @@
#! /bin/bash #! /bin/bash
set -e set -e
# These tests spawn the counter app and server by execing the TMSP_APP command and run some simple client tests against it
# These tests spawn the counter app and server by execing the ABCI_APP command and run some simple client tests against it
ROOT=$GOPATH/src/github.com/tendermint/tmsp/tests/test_app
ROOT=$GOPATH/src/github.com/tendermint/abci/tests/test_app
cd $ROOT cd $ROOT
# test golang counter # test golang counter
TMSP_APP="counter" go run *.go
ABCI_APP="counter" go run *.go
# test golang counter via grpc # test golang counter via grpc
TMSP_APP="counter -tmsp=grpc" TMSP="grpc" go run *.go
ABCI_APP="counter -abci=grpc" ABCI="grpc" go run *.go
# test nodejs counter # test nodejs counter
# TODO: fix node app # TODO: fix node app
#TMSP_APP="node $GOPATH/src/github.com/tendermint/js-tmsp/example/app.js" go test -test.run TestCounter
#ABCI_APP="node $GOPATH/src/github.com/tendermint/js-abci/example/app.js" go test -test.run TestCounter

tests/test_cli/ex1.tmsp → tests/test_cli/ex1.abci View File


tests/test_cli/ex1.tmsp.out → tests/test_cli/ex1.abci.out View File


tests/test_cli/ex2.tmsp → tests/test_cli/ex2.abci View File


tests/test_cli/ex2.tmsp.out → tests/test_cli/ex2.abci.out View File


+ 5
- 3
tests/test_cli/test.sh View File

@ -1,5 +1,7 @@
#! /bin/bash #! /bin/bash
cd $GOPATH/src/github.com/tendermint/abci
function testExample() { function testExample() {
N=$1 N=$1
INPUT=$2 INPUT=$2
@ -8,7 +10,7 @@ function testExample() {
echo "Example $N" echo "Example $N"
$APP &> /dev/null & $APP &> /dev/null &
sleep 2 sleep 2
tmsp-cli --verbose batch < $INPUT > "${INPUT}.out.new"
abci-cli --verbose batch < $INPUT > "${INPUT}.out.new"
killall "$APP" killall "$APP"
pre=`shasum < "${INPUT}.out"` pre=`shasum < "${INPUT}.out"`
@ -26,8 +28,8 @@ function testExample() {
rm "${INPUT}".out.new rm "${INPUT}".out.new
} }
testExample 1 tests/test_cli/ex1.tmsp dummy
testExample 2 tests/test_cli/ex2.tmsp counter
testExample 1 tests/test_cli/ex1.abci dummy
testExample 2 tests/test_cli/ex2.abci counter
echo "" echo ""
echo "PASS" echo "PASS"

+ 1
- 1
testutil/messages.go View File

@ -2,7 +2,7 @@ package testutil
import ( import (
"github.com/tendermint/go-crypto" "github.com/tendermint/go-crypto"
"github.com/tendermint/tmsp/types"
"github.com/tendermint/abci/types"
) )
//---------------------------------------- //----------------------------------------


+ 5
- 5
types/application.go View File

@ -13,8 +13,8 @@ type Application interface {
// Set application option (e.g. mode=mempool, mode=consensus) // Set application option (e.g. mode=mempool, mode=consensus)
SetOption(key string, value string) (log string) SetOption(key string, value string) (log string)
// Append a tx
AppendTx(tx []byte) Result
// Deliver a tx
DeliverTx(tx []byte) Result
// Validate a tx for the mempool // Validate a tx for the mempool
CheckTx(tx []byte) Result CheckTx(tx []byte) Result
@ -67,9 +67,9 @@ func (app *GRPCApplication) SetOption(ctx context.Context, req *RequestSetOption
return &ResponseSetOption{app.app.SetOption(req.Key, req.Value)}, nil return &ResponseSetOption{app.app.SetOption(req.Key, req.Value)}, nil
} }
func (app *GRPCApplication) AppendTx(ctx context.Context, req *RequestAppendTx) (*ResponseAppendTx, error) {
r := app.app.AppendTx(req.Tx)
return &ResponseAppendTx{r.Code, r.Data, r.Log}, nil
func (app *GRPCApplication) DeliverTx(ctx context.Context, req *RequestDeliverTx) (*ResponseDeliverTx, error) {
r := app.app.DeliverTx(req.Tx)
return &ResponseDeliverTx{r.Code, r.Data, r.Log}, nil
} }
func (app *GRPCApplication) CheckTx(ctx context.Context, req *RequestCheckTx) (*ResponseCheckTx, error) { func (app *GRPCApplication) CheckTx(ctx context.Context, req *RequestCheckTx) (*ResponseCheckTx, error) {


+ 4
- 4
types/messages.go View File

@ -31,9 +31,9 @@ func ToRequestSetOption(key string, value string) *Request {
} }
} }
func ToRequestAppendTx(txBytes []byte) *Request {
func ToRequestDeliverTx(txBytes []byte) *Request {
return &Request{ return &Request{
Value: &Request_AppendTx{&RequestAppendTx{txBytes}},
Value: &Request_DeliverTx{&RequestDeliverTx{txBytes}},
} }
} }
@ -105,9 +105,9 @@ func ToResponseSetOption(log string) *Response {
} }
} }
func ToResponseAppendTx(code CodeType, data []byte, log string) *Response {
func ToResponseDeliverTx(code CodeType, data []byte, log string) *Response {
return &Response{ return &Response{
Value: &Response_AppendTx{&ResponseAppendTx{code, data, log}},
Value: &Response_DeliverTx{&ResponseDeliverTx{code, data, log}},
} }
} }


+ 1
- 1
types/result.go View File

@ -28,7 +28,7 @@ func (res Result) IsErr() bool {
} }
func (res Result) Error() string { func (res Result) Error() string {
return fmt.Sprintf("TMSP code:%v, data:%X, log:%v", res.Code, res.Data, res.Log)
return fmt.Sprintf("ABCI code:%v, data:%X, log:%v", res.Code, res.Data, res.Log)
} }
func (res Result) PrependLog(log string) Result { func (res Result) PrependLog(log string) Result {


+ 133
- 133
types/types.pb.go View File

@ -14,7 +14,7 @@ It has these top-level messages:
RequestFlush RequestFlush
RequestInfo RequestInfo
RequestSetOption RequestSetOption
RequestAppendTx
RequestDeliverTx
RequestCheckTx RequestCheckTx
RequestQuery RequestQuery
RequestCommit RequestCommit
@ -27,7 +27,7 @@ It has these top-level messages:
ResponseFlush ResponseFlush
ResponseInfo ResponseInfo
ResponseSetOption ResponseSetOption
ResponseAppendTx
ResponseDeliverTx
ResponseCheckTx ResponseCheckTx
ResponseQuery ResponseQuery
ResponseCommit ResponseCommit
@ -74,7 +74,7 @@ const (
MessageType_Info MessageType = 3 MessageType_Info MessageType = 3
MessageType_SetOption MessageType = 4 MessageType_SetOption MessageType = 4
MessageType_Exception MessageType = 5 MessageType_Exception MessageType = 5
MessageType_AppendTx MessageType = 17
MessageType_DeliverTx MessageType = 17
MessageType_CheckTx MessageType = 18 MessageType_CheckTx MessageType = 18
MessageType_Commit MessageType = 19 MessageType_Commit MessageType = 19
MessageType_Query MessageType = 20 MessageType_Query MessageType = 20
@ -90,7 +90,7 @@ var MessageType_name = map[int32]string{
3: "Info", 3: "Info",
4: "SetOption", 4: "SetOption",
5: "Exception", 5: "Exception",
17: "AppendTx",
17: "DeliverTx",
18: "CheckTx", 18: "CheckTx",
19: "Commit", 19: "Commit",
20: "Query", 20: "Query",
@ -105,7 +105,7 @@ var MessageType_value = map[string]int32{
"Info": 3, "Info": 3,
"SetOption": 4, "SetOption": 4,
"Exception": 5, "Exception": 5,
"AppendTx": 17,
"DeliverTx": 17,
"CheckTx": 18, "CheckTx": 18,
"Commit": 19, "Commit": 19,
"Query": 20, "Query": 20,
@ -233,7 +233,7 @@ type Request struct {
// *Request_Flush // *Request_Flush
// *Request_Info // *Request_Info
// *Request_SetOption // *Request_SetOption
// *Request_AppendTx
// *Request_DeliverTx
// *Request_CheckTx // *Request_CheckTx
// *Request_Commit // *Request_Commit
// *Request_Query // *Request_Query
@ -264,8 +264,8 @@ type Request_Info struct {
type Request_SetOption struct { type Request_SetOption struct {
SetOption *RequestSetOption `protobuf:"bytes,4,opt,name=set_option,json=setOption,oneof"` SetOption *RequestSetOption `protobuf:"bytes,4,opt,name=set_option,json=setOption,oneof"`
} }
type Request_AppendTx struct {
AppendTx *RequestAppendTx `protobuf:"bytes,5,opt,name=append_tx,json=appendTx,oneof"`
type Request_DeliverTx struct {
DeliverTx *RequestDeliverTx `protobuf:"bytes,5,opt,name=deliver_tx,json=deliverTx,oneof"`
} }
type Request_CheckTx struct { type Request_CheckTx struct {
CheckTx *RequestCheckTx `protobuf:"bytes,6,opt,name=check_tx,json=checkTx,oneof"` CheckTx *RequestCheckTx `protobuf:"bytes,6,opt,name=check_tx,json=checkTx,oneof"`
@ -290,7 +290,7 @@ func (*Request_Echo) isRequest_Value() {}
func (*Request_Flush) isRequest_Value() {} func (*Request_Flush) isRequest_Value() {}
func (*Request_Info) isRequest_Value() {} func (*Request_Info) isRequest_Value() {}
func (*Request_SetOption) isRequest_Value() {} func (*Request_SetOption) isRequest_Value() {}
func (*Request_AppendTx) isRequest_Value() {}
func (*Request_DeliverTx) isRequest_Value() {}
func (*Request_CheckTx) isRequest_Value() {} func (*Request_CheckTx) isRequest_Value() {}
func (*Request_Commit) isRequest_Value() {} func (*Request_Commit) isRequest_Value() {}
func (*Request_Query) isRequest_Value() {} func (*Request_Query) isRequest_Value() {}
@ -333,9 +333,9 @@ func (m *Request) GetSetOption() *RequestSetOption {
return nil return nil
} }
func (m *Request) GetAppendTx() *RequestAppendTx {
if x, ok := m.GetValue().(*Request_AppendTx); ok {
return x.AppendTx
func (m *Request) GetDeliverTx() *RequestDeliverTx {
if x, ok := m.GetValue().(*Request_DeliverTx); ok {
return x.DeliverTx
} }
return nil return nil
} }
@ -389,7 +389,7 @@ func (*Request) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error
(*Request_Flush)(nil), (*Request_Flush)(nil),
(*Request_Info)(nil), (*Request_Info)(nil),
(*Request_SetOption)(nil), (*Request_SetOption)(nil),
(*Request_AppendTx)(nil),
(*Request_DeliverTx)(nil),
(*Request_CheckTx)(nil), (*Request_CheckTx)(nil),
(*Request_Commit)(nil), (*Request_Commit)(nil),
(*Request_Query)(nil), (*Request_Query)(nil),
@ -423,9 +423,9 @@ func _Request_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
if err := b.EncodeMessage(x.SetOption); err != nil { if err := b.EncodeMessage(x.SetOption); err != nil {
return err return err
} }
case *Request_AppendTx:
case *Request_DeliverTx:
b.EncodeVarint(5<<3 | proto.WireBytes) b.EncodeVarint(5<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.AppendTx); err != nil {
if err := b.EncodeMessage(x.DeliverTx); err != nil {
return err return err
} }
case *Request_CheckTx: case *Request_CheckTx:
@ -500,13 +500,13 @@ func _Request_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer
err := b.DecodeMessage(msg) err := b.DecodeMessage(msg)
m.Value = &Request_SetOption{msg} m.Value = &Request_SetOption{msg}
return true, err return true, err
case 5: // value.append_tx
case 5: // value.deliver_tx
if wire != proto.WireBytes { if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType return true, proto.ErrInternalBadWireType
} }
msg := new(RequestAppendTx)
msg := new(RequestDeliverTx)
err := b.DecodeMessage(msg) err := b.DecodeMessage(msg)
m.Value = &Request_AppendTx{msg}
m.Value = &Request_DeliverTx{msg}
return true, err return true, err
case 6: // value.check_tx case 6: // value.check_tx
if wire != proto.WireBytes { if wire != proto.WireBytes {
@ -585,8 +585,8 @@ func _Request_OneofSizer(msg proto.Message) (n int) {
n += proto.SizeVarint(4<<3 | proto.WireBytes) n += proto.SizeVarint(4<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *Request_AppendTx:
s := proto.Size(x.AppendTx)
case *Request_DeliverTx:
s := proto.Size(x.DeliverTx)
n += proto.SizeVarint(5<<3 | proto.WireBytes) n += proto.SizeVarint(5<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
@ -683,16 +683,16 @@ func (m *RequestSetOption) GetValue() string {
return "" return ""
} }
type RequestAppendTx struct {
type RequestDeliverTx struct {
Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"` Tx []byte `protobuf:"bytes,1,opt,name=tx,proto3" json:"tx,omitempty"`
} }
func (m *RequestAppendTx) Reset() { *m = RequestAppendTx{} }
func (m *RequestAppendTx) String() string { return proto.CompactTextString(m) }
func (*RequestAppendTx) ProtoMessage() {}
func (*RequestAppendTx) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *RequestDeliverTx) Reset() { *m = RequestDeliverTx{} }
func (m *RequestDeliverTx) String() string { return proto.CompactTextString(m) }
func (*RequestDeliverTx) ProtoMessage() {}
func (*RequestDeliverTx) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
func (m *RequestAppendTx) GetTx() []byte {
func (m *RequestDeliverTx) GetTx() []byte {
if m != nil { if m != nil {
return m.Tx return m.Tx
} }
@ -802,7 +802,7 @@ type Response struct {
// *Response_Flush // *Response_Flush
// *Response_Info // *Response_Info
// *Response_SetOption // *Response_SetOption
// *Response_AppendTx
// *Response_DeliverTx
// *Response_CheckTx // *Response_CheckTx
// *Response_Commit // *Response_Commit
// *Response_Query // *Response_Query
@ -836,8 +836,8 @@ type Response_Info struct {
type Response_SetOption struct { type Response_SetOption struct {
SetOption *ResponseSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,oneof"` SetOption *ResponseSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,oneof"`
} }
type Response_AppendTx struct {
AppendTx *ResponseAppendTx `protobuf:"bytes,6,opt,name=append_tx,json=appendTx,oneof"`
type Response_DeliverTx struct {
DeliverTx *ResponseDeliverTx `protobuf:"bytes,6,opt,name=deliver_tx,json=deliverTx,oneof"`
} }
type Response_CheckTx struct { type Response_CheckTx struct {
CheckTx *ResponseCheckTx `protobuf:"bytes,7,opt,name=check_tx,json=checkTx,oneof"` CheckTx *ResponseCheckTx `protobuf:"bytes,7,opt,name=check_tx,json=checkTx,oneof"`
@ -863,7 +863,7 @@ func (*Response_Echo) isResponse_Value() {}
func (*Response_Flush) isResponse_Value() {} func (*Response_Flush) isResponse_Value() {}
func (*Response_Info) isResponse_Value() {} func (*Response_Info) isResponse_Value() {}
func (*Response_SetOption) isResponse_Value() {} func (*Response_SetOption) isResponse_Value() {}
func (*Response_AppendTx) isResponse_Value() {}
func (*Response_DeliverTx) isResponse_Value() {}
func (*Response_CheckTx) isResponse_Value() {} func (*Response_CheckTx) isResponse_Value() {}
func (*Response_Commit) isResponse_Value() {} func (*Response_Commit) isResponse_Value() {}
func (*Response_Query) isResponse_Value() {} func (*Response_Query) isResponse_Value() {}
@ -913,9 +913,9 @@ func (m *Response) GetSetOption() *ResponseSetOption {
return nil return nil
} }
func (m *Response) GetAppendTx() *ResponseAppendTx {
if x, ok := m.GetValue().(*Response_AppendTx); ok {
return x.AppendTx
func (m *Response) GetDeliverTx() *ResponseDeliverTx {
if x, ok := m.GetValue().(*Response_DeliverTx); ok {
return x.DeliverTx
} }
return nil return nil
} }
@ -970,7 +970,7 @@ func (*Response) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) erro
(*Response_Flush)(nil), (*Response_Flush)(nil),
(*Response_Info)(nil), (*Response_Info)(nil),
(*Response_SetOption)(nil), (*Response_SetOption)(nil),
(*Response_AppendTx)(nil),
(*Response_DeliverTx)(nil),
(*Response_CheckTx)(nil), (*Response_CheckTx)(nil),
(*Response_Commit)(nil), (*Response_Commit)(nil),
(*Response_Query)(nil), (*Response_Query)(nil),
@ -1009,9 +1009,9 @@ func _Response_OneofMarshaler(msg proto.Message, b *proto.Buffer) error {
if err := b.EncodeMessage(x.SetOption); err != nil { if err := b.EncodeMessage(x.SetOption); err != nil {
return err return err
} }
case *Response_AppendTx:
case *Response_DeliverTx:
b.EncodeVarint(6<<3 | proto.WireBytes) b.EncodeVarint(6<<3 | proto.WireBytes)
if err := b.EncodeMessage(x.AppendTx); err != nil {
if err := b.EncodeMessage(x.DeliverTx); err != nil {
return err return err
} }
case *Response_CheckTx: case *Response_CheckTx:
@ -1094,13 +1094,13 @@ func _Response_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffe
err := b.DecodeMessage(msg) err := b.DecodeMessage(msg)
m.Value = &Response_SetOption{msg} m.Value = &Response_SetOption{msg}
return true, err return true, err
case 6: // value.append_tx
case 6: // value.deliver_tx
if wire != proto.WireBytes { if wire != proto.WireBytes {
return true, proto.ErrInternalBadWireType return true, proto.ErrInternalBadWireType
} }
msg := new(ResponseAppendTx)
msg := new(ResponseDeliverTx)
err := b.DecodeMessage(msg) err := b.DecodeMessage(msg)
m.Value = &Response_AppendTx{msg}
m.Value = &Response_DeliverTx{msg}
return true, err return true, err
case 7: // value.check_tx case 7: // value.check_tx
if wire != proto.WireBytes { if wire != proto.WireBytes {
@ -1184,8 +1184,8 @@ func _Response_OneofSizer(msg proto.Message) (n int) {
n += proto.SizeVarint(5<<3 | proto.WireBytes) n += proto.SizeVarint(5<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
case *Response_AppendTx:
s := proto.Size(x.AppendTx)
case *Response_DeliverTx:
s := proto.Size(x.DeliverTx)
n += proto.SizeVarint(6<<3 | proto.WireBytes) n += proto.SizeVarint(6<<3 | proto.WireBytes)
n += proto.SizeVarint(uint64(s)) n += proto.SizeVarint(uint64(s))
n += s n += s
@ -1322,32 +1322,32 @@ func (m *ResponseSetOption) GetLog() string {
return "" return ""
} }
type ResponseAppendTx struct {
type ResponseDeliverTx struct {
Code CodeType `protobuf:"varint,1,opt,name=code,enum=types.CodeType" json:"code,omitempty"` Code CodeType `protobuf:"varint,1,opt,name=code,enum=types.CodeType" json:"code,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Log string `protobuf:"bytes,3,opt,name=log" json:"log,omitempty"` Log string `protobuf:"bytes,3,opt,name=log" json:"log,omitempty"`
} }
func (m *ResponseAppendTx) Reset() { *m = ResponseAppendTx{} }
func (m *ResponseAppendTx) String() string { return proto.CompactTextString(m) }
func (*ResponseAppendTx) ProtoMessage() {}
func (*ResponseAppendTx) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (m *ResponseDeliverTx) Reset() { *m = ResponseDeliverTx{} }
func (m *ResponseDeliverTx) String() string { return proto.CompactTextString(m) }
func (*ResponseDeliverTx) ProtoMessage() {}
func (*ResponseDeliverTx) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} }
func (m *ResponseAppendTx) GetCode() CodeType {
func (m *ResponseDeliverTx) GetCode() CodeType {
if m != nil { if m != nil {
return m.Code return m.Code
} }
return CodeType_OK return CodeType_OK
} }
func (m *ResponseAppendTx) GetData() []byte {
func (m *ResponseDeliverTx) GetData() []byte {
if m != nil { if m != nil {
return m.Data return m.Data
} }
return nil return nil
} }
func (m *ResponseAppendTx) GetLog() string {
func (m *ResponseDeliverTx) GetLog() string {
if m != nil { if m != nil {
return m.Log return m.Log
} }
@ -1640,7 +1640,7 @@ func init() {
proto.RegisterType((*RequestFlush)(nil), "types.RequestFlush") proto.RegisterType((*RequestFlush)(nil), "types.RequestFlush")
proto.RegisterType((*RequestInfo)(nil), "types.RequestInfo") proto.RegisterType((*RequestInfo)(nil), "types.RequestInfo")
proto.RegisterType((*RequestSetOption)(nil), "types.RequestSetOption") proto.RegisterType((*RequestSetOption)(nil), "types.RequestSetOption")
proto.RegisterType((*RequestAppendTx)(nil), "types.RequestAppendTx")
proto.RegisterType((*RequestDeliverTx)(nil), "types.RequestDeliverTx")
proto.RegisterType((*RequestCheckTx)(nil), "types.RequestCheckTx") proto.RegisterType((*RequestCheckTx)(nil), "types.RequestCheckTx")
proto.RegisterType((*RequestQuery)(nil), "types.RequestQuery") proto.RegisterType((*RequestQuery)(nil), "types.RequestQuery")
proto.RegisterType((*RequestCommit)(nil), "types.RequestCommit") proto.RegisterType((*RequestCommit)(nil), "types.RequestCommit")
@ -1653,7 +1653,7 @@ func init() {
proto.RegisterType((*ResponseFlush)(nil), "types.ResponseFlush") proto.RegisterType((*ResponseFlush)(nil), "types.ResponseFlush")
proto.RegisterType((*ResponseInfo)(nil), "types.ResponseInfo") proto.RegisterType((*ResponseInfo)(nil), "types.ResponseInfo")
proto.RegisterType((*ResponseSetOption)(nil), "types.ResponseSetOption") proto.RegisterType((*ResponseSetOption)(nil), "types.ResponseSetOption")
proto.RegisterType((*ResponseAppendTx)(nil), "types.ResponseAppendTx")
proto.RegisterType((*ResponseDeliverTx)(nil), "types.ResponseDeliverTx")
proto.RegisterType((*ResponseCheckTx)(nil), "types.ResponseCheckTx") proto.RegisterType((*ResponseCheckTx)(nil), "types.ResponseCheckTx")
proto.RegisterType((*ResponseQuery)(nil), "types.ResponseQuery") proto.RegisterType((*ResponseQuery)(nil), "types.ResponseQuery")
proto.RegisterType((*ResponseCommit)(nil), "types.ResponseCommit") proto.RegisterType((*ResponseCommit)(nil), "types.ResponseCommit")
@ -1676,14 +1676,14 @@ var _ grpc.ClientConn
// is compatible with the grpc package it is being compiled against. // is compatible with the grpc package it is being compiled against.
const _ = grpc.SupportPackageIsVersion4 const _ = grpc.SupportPackageIsVersion4
// Client API for TMSPApplication service
// Client API for ABCIApplication service
type TMSPApplicationClient interface {
type ABCIApplicationClient interface {
Echo(ctx context.Context, in *RequestEcho, opts ...grpc.CallOption) (*ResponseEcho, error) Echo(ctx context.Context, in *RequestEcho, opts ...grpc.CallOption) (*ResponseEcho, error)
Flush(ctx context.Context, in *RequestFlush, opts ...grpc.CallOption) (*ResponseFlush, error) Flush(ctx context.Context, in *RequestFlush, opts ...grpc.CallOption) (*ResponseFlush, error)
Info(ctx context.Context, in *RequestInfo, opts ...grpc.CallOption) (*ResponseInfo, error) Info(ctx context.Context, in *RequestInfo, opts ...grpc.CallOption) (*ResponseInfo, error)
SetOption(ctx context.Context, in *RequestSetOption, opts ...grpc.CallOption) (*ResponseSetOption, error) SetOption(ctx context.Context, in *RequestSetOption, opts ...grpc.CallOption) (*ResponseSetOption, error)
AppendTx(ctx context.Context, in *RequestAppendTx, opts ...grpc.CallOption) (*ResponseAppendTx, error)
DeliverTx(ctx context.Context, in *RequestDeliverTx, opts ...grpc.CallOption) (*ResponseDeliverTx, error)
CheckTx(ctx context.Context, in *RequestCheckTx, opts ...grpc.CallOption) (*ResponseCheckTx, error) CheckTx(ctx context.Context, in *RequestCheckTx, opts ...grpc.CallOption) (*ResponseCheckTx, error)
Query(ctx context.Context, in *RequestQuery, opts ...grpc.CallOption) (*ResponseQuery, error) Query(ctx context.Context, in *RequestQuery, opts ...grpc.CallOption) (*ResponseQuery, error)
Commit(ctx context.Context, in *RequestCommit, opts ...grpc.CallOption) (*ResponseCommit, error) Commit(ctx context.Context, in *RequestCommit, opts ...grpc.CallOption) (*ResponseCommit, error)
@ -1696,13 +1696,13 @@ type tMSPApplicationClient struct {
cc *grpc.ClientConn cc *grpc.ClientConn
} }
func NewTMSPApplicationClient(cc *grpc.ClientConn) TMSPApplicationClient {
func NewABCIApplicationClient(cc *grpc.ClientConn) ABCIApplicationClient {
return &tMSPApplicationClient{cc} return &tMSPApplicationClient{cc}
} }
func (c *tMSPApplicationClient) Echo(ctx context.Context, in *RequestEcho, opts ...grpc.CallOption) (*ResponseEcho, error) { func (c *tMSPApplicationClient) Echo(ctx context.Context, in *RequestEcho, opts ...grpc.CallOption) (*ResponseEcho, error) {
out := new(ResponseEcho) out := new(ResponseEcho)
err := grpc.Invoke(ctx, "/types.TMSPApplication/Echo", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/Echo", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1711,7 +1711,7 @@ func (c *tMSPApplicationClient) Echo(ctx context.Context, in *RequestEcho, opts
func (c *tMSPApplicationClient) Flush(ctx context.Context, in *RequestFlush, opts ...grpc.CallOption) (*ResponseFlush, error) { func (c *tMSPApplicationClient) Flush(ctx context.Context, in *RequestFlush, opts ...grpc.CallOption) (*ResponseFlush, error) {
out := new(ResponseFlush) out := new(ResponseFlush)
err := grpc.Invoke(ctx, "/types.TMSPApplication/Flush", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/Flush", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1720,7 +1720,7 @@ func (c *tMSPApplicationClient) Flush(ctx context.Context, in *RequestFlush, opt
func (c *tMSPApplicationClient) Info(ctx context.Context, in *RequestInfo, opts ...grpc.CallOption) (*ResponseInfo, error) { func (c *tMSPApplicationClient) Info(ctx context.Context, in *RequestInfo, opts ...grpc.CallOption) (*ResponseInfo, error) {
out := new(ResponseInfo) out := new(ResponseInfo)
err := grpc.Invoke(ctx, "/types.TMSPApplication/Info", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/Info", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1729,16 +1729,16 @@ func (c *tMSPApplicationClient) Info(ctx context.Context, in *RequestInfo, opts
func (c *tMSPApplicationClient) SetOption(ctx context.Context, in *RequestSetOption, opts ...grpc.CallOption) (*ResponseSetOption, error) { func (c *tMSPApplicationClient) SetOption(ctx context.Context, in *RequestSetOption, opts ...grpc.CallOption) (*ResponseSetOption, error) {
out := new(ResponseSetOption) out := new(ResponseSetOption)
err := grpc.Invoke(ctx, "/types.TMSPApplication/SetOption", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/SetOption", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return out, nil return out, nil
} }
func (c *tMSPApplicationClient) AppendTx(ctx context.Context, in *RequestAppendTx, opts ...grpc.CallOption) (*ResponseAppendTx, error) {
out := new(ResponseAppendTx)
err := grpc.Invoke(ctx, "/types.TMSPApplication/AppendTx", in, out, c.cc, opts...)
func (c *tMSPApplicationClient) DeliverTx(ctx context.Context, in *RequestDeliverTx, opts ...grpc.CallOption) (*ResponseDeliverTx, error) {
out := new(ResponseDeliverTx)
err := grpc.Invoke(ctx, "/types.ABCIApplication/DeliverTx", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1747,7 +1747,7 @@ func (c *tMSPApplicationClient) AppendTx(ctx context.Context, in *RequestAppendT
func (c *tMSPApplicationClient) CheckTx(ctx context.Context, in *RequestCheckTx, opts ...grpc.CallOption) (*ResponseCheckTx, error) { func (c *tMSPApplicationClient) CheckTx(ctx context.Context, in *RequestCheckTx, opts ...grpc.CallOption) (*ResponseCheckTx, error) {
out := new(ResponseCheckTx) out := new(ResponseCheckTx)
err := grpc.Invoke(ctx, "/types.TMSPApplication/CheckTx", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/CheckTx", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1756,7 +1756,7 @@ func (c *tMSPApplicationClient) CheckTx(ctx context.Context, in *RequestCheckTx,
func (c *tMSPApplicationClient) Query(ctx context.Context, in *RequestQuery, opts ...grpc.CallOption) (*ResponseQuery, error) { func (c *tMSPApplicationClient) Query(ctx context.Context, in *RequestQuery, opts ...grpc.CallOption) (*ResponseQuery, error) {
out := new(ResponseQuery) out := new(ResponseQuery)
err := grpc.Invoke(ctx, "/types.TMSPApplication/Query", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/Query", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1765,7 +1765,7 @@ func (c *tMSPApplicationClient) Query(ctx context.Context, in *RequestQuery, opt
func (c *tMSPApplicationClient) Commit(ctx context.Context, in *RequestCommit, opts ...grpc.CallOption) (*ResponseCommit, error) { func (c *tMSPApplicationClient) Commit(ctx context.Context, in *RequestCommit, opts ...grpc.CallOption) (*ResponseCommit, error) {
out := new(ResponseCommit) out := new(ResponseCommit)
err := grpc.Invoke(ctx, "/types.TMSPApplication/Commit", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/Commit", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1774,7 +1774,7 @@ func (c *tMSPApplicationClient) Commit(ctx context.Context, in *RequestCommit, o
func (c *tMSPApplicationClient) InitChain(ctx context.Context, in *RequestInitChain, opts ...grpc.CallOption) (*ResponseInitChain, error) { func (c *tMSPApplicationClient) InitChain(ctx context.Context, in *RequestInitChain, opts ...grpc.CallOption) (*ResponseInitChain, error) {
out := new(ResponseInitChain) out := new(ResponseInitChain)
err := grpc.Invoke(ctx, "/types.TMSPApplication/InitChain", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/InitChain", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1783,7 +1783,7 @@ func (c *tMSPApplicationClient) InitChain(ctx context.Context, in *RequestInitCh
func (c *tMSPApplicationClient) BeginBlock(ctx context.Context, in *RequestBeginBlock, opts ...grpc.CallOption) (*ResponseBeginBlock, error) { func (c *tMSPApplicationClient) BeginBlock(ctx context.Context, in *RequestBeginBlock, opts ...grpc.CallOption) (*ResponseBeginBlock, error) {
out := new(ResponseBeginBlock) out := new(ResponseBeginBlock)
err := grpc.Invoke(ctx, "/types.TMSPApplication/BeginBlock", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/BeginBlock", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -1792,21 +1792,21 @@ func (c *tMSPApplicationClient) BeginBlock(ctx context.Context, in *RequestBegin
func (c *tMSPApplicationClient) EndBlock(ctx context.Context, in *RequestEndBlock, opts ...grpc.CallOption) (*ResponseEndBlock, error) { func (c *tMSPApplicationClient) EndBlock(ctx context.Context, in *RequestEndBlock, opts ...grpc.CallOption) (*ResponseEndBlock, error) {
out := new(ResponseEndBlock) out := new(ResponseEndBlock)
err := grpc.Invoke(ctx, "/types.TMSPApplication/EndBlock", in, out, c.cc, opts...)
err := grpc.Invoke(ctx, "/types.ABCIApplication/EndBlock", in, out, c.cc, opts...)
if err != nil { if err != nil {
return nil, err return nil, err
} }
return out, nil return out, nil
} }
// Server API for TMSPApplication service
// Server API for ABCIApplication service
type TMSPApplicationServer interface {
type ABCIApplicationServer interface {
Echo(context.Context, *RequestEcho) (*ResponseEcho, error) Echo(context.Context, *RequestEcho) (*ResponseEcho, error)
Flush(context.Context, *RequestFlush) (*ResponseFlush, error) Flush(context.Context, *RequestFlush) (*ResponseFlush, error)
Info(context.Context, *RequestInfo) (*ResponseInfo, error) Info(context.Context, *RequestInfo) (*ResponseInfo, error)
SetOption(context.Context, *RequestSetOption) (*ResponseSetOption, error) SetOption(context.Context, *RequestSetOption) (*ResponseSetOption, error)
AppendTx(context.Context, *RequestAppendTx) (*ResponseAppendTx, error)
DeliverTx(context.Context, *RequestDeliverTx) (*ResponseDeliverTx, error)
CheckTx(context.Context, *RequestCheckTx) (*ResponseCheckTx, error) CheckTx(context.Context, *RequestCheckTx) (*ResponseCheckTx, error)
Query(context.Context, *RequestQuery) (*ResponseQuery, error) Query(context.Context, *RequestQuery) (*ResponseQuery, error)
Commit(context.Context, *RequestCommit) (*ResponseCommit, error) Commit(context.Context, *RequestCommit) (*ResponseCommit, error)
@ -1815,255 +1815,255 @@ type TMSPApplicationServer interface {
EndBlock(context.Context, *RequestEndBlock) (*ResponseEndBlock, error) EndBlock(context.Context, *RequestEndBlock) (*ResponseEndBlock, error)
} }
func RegisterTMSPApplicationServer(s *grpc.Server, srv TMSPApplicationServer) {
s.RegisterService(&_TMSPApplication_serviceDesc, srv)
func RegisterABCIApplicationServer(s *grpc.Server, srv ABCIApplicationServer) {
s.RegisterService(&_ABCIApplication_serviceDesc, srv)
} }
func _TMSPApplication_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_Echo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestEcho) in := new(RequestEcho)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).Echo(ctx, in)
return srv.(ABCIApplicationServer).Echo(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/Echo",
FullMethod: "/types.ABCIApplication/Echo",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).Echo(ctx, req.(*RequestEcho))
return srv.(ABCIApplicationServer).Echo(ctx, req.(*RequestEcho))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_Flush_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_Flush_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestFlush) in := new(RequestFlush)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).Flush(ctx, in)
return srv.(ABCIApplicationServer).Flush(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/Flush",
FullMethod: "/types.ABCIApplication/Flush",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).Flush(ctx, req.(*RequestFlush))
return srv.(ABCIApplicationServer).Flush(ctx, req.(*RequestFlush))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_Info_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestInfo) in := new(RequestInfo)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).Info(ctx, in)
return srv.(ABCIApplicationServer).Info(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/Info",
FullMethod: "/types.ABCIApplication/Info",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).Info(ctx, req.(*RequestInfo))
return srv.(ABCIApplicationServer).Info(ctx, req.(*RequestInfo))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_SetOption_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_SetOption_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestSetOption) in := new(RequestSetOption)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).SetOption(ctx, in)
return srv.(ABCIApplicationServer).SetOption(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/SetOption",
FullMethod: "/types.ABCIApplication/SetOption",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).SetOption(ctx, req.(*RequestSetOption))
return srv.(ABCIApplicationServer).SetOption(ctx, req.(*RequestSetOption))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_AppendTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestAppendTx)
func _ABCIApplication_DeliverTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestDeliverTx)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).AppendTx(ctx, in)
return srv.(ABCIApplicationServer).DeliverTx(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/AppendTx",
FullMethod: "/types.ABCIApplication/DeliverTx",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).AppendTx(ctx, req.(*RequestAppendTx))
return srv.(ABCIApplicationServer).DeliverTx(ctx, req.(*RequestDeliverTx))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_CheckTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_CheckTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestCheckTx) in := new(RequestCheckTx)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).CheckTx(ctx, in)
return srv.(ABCIApplicationServer).CheckTx(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/CheckTx",
FullMethod: "/types.ABCIApplication/CheckTx",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).CheckTx(ctx, req.(*RequestCheckTx))
return srv.(ABCIApplicationServer).CheckTx(ctx, req.(*RequestCheckTx))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestQuery) in := new(RequestQuery)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).Query(ctx, in)
return srv.(ABCIApplicationServer).Query(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/Query",
FullMethod: "/types.ABCIApplication/Query",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).Query(ctx, req.(*RequestQuery))
return srv.(ABCIApplicationServer).Query(ctx, req.(*RequestQuery))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_Commit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_Commit_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestCommit) in := new(RequestCommit)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).Commit(ctx, in)
return srv.(ABCIApplicationServer).Commit(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/Commit",
FullMethod: "/types.ABCIApplication/Commit",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).Commit(ctx, req.(*RequestCommit))
return srv.(ABCIApplicationServer).Commit(ctx, req.(*RequestCommit))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_InitChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_InitChain_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestInitChain) in := new(RequestInitChain)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).InitChain(ctx, in)
return srv.(ABCIApplicationServer).InitChain(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/InitChain",
FullMethod: "/types.ABCIApplication/InitChain",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).InitChain(ctx, req.(*RequestInitChain))
return srv.(ABCIApplicationServer).InitChain(ctx, req.(*RequestInitChain))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_BeginBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_BeginBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestBeginBlock) in := new(RequestBeginBlock)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).BeginBlock(ctx, in)
return srv.(ABCIApplicationServer).BeginBlock(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/BeginBlock",
FullMethod: "/types.ABCIApplication/BeginBlock",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).BeginBlock(ctx, req.(*RequestBeginBlock))
return srv.(ABCIApplicationServer).BeginBlock(ctx, req.(*RequestBeginBlock))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
func _TMSPApplication_EndBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
func _ABCIApplication_EndBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
in := new(RequestEndBlock) in := new(RequestEndBlock)
if err := dec(in); err != nil { if err := dec(in); err != nil {
return nil, err return nil, err
} }
if interceptor == nil { if interceptor == nil {
return srv.(TMSPApplicationServer).EndBlock(ctx, in)
return srv.(ABCIApplicationServer).EndBlock(ctx, in)
} }
info := &grpc.UnaryServerInfo{ info := &grpc.UnaryServerInfo{
Server: srv, Server: srv,
FullMethod: "/types.TMSPApplication/EndBlock",
FullMethod: "/types.ABCIApplication/EndBlock",
} }
handler := func(ctx context.Context, req interface{}) (interface{}, error) { handler := func(ctx context.Context, req interface{}) (interface{}, error) {
return srv.(TMSPApplicationServer).EndBlock(ctx, req.(*RequestEndBlock))
return srv.(ABCIApplicationServer).EndBlock(ctx, req.(*RequestEndBlock))
} }
return interceptor(ctx, in, info, handler) return interceptor(ctx, in, info, handler)
} }
var _TMSPApplication_serviceDesc = grpc.ServiceDesc{
ServiceName: "types.TMSPApplication",
HandlerType: (*TMSPApplicationServer)(nil),
var _ABCIApplication_serviceDesc = grpc.ServiceDesc{
ServiceName: "types.ABCIApplication",
HandlerType: (*ABCIApplicationServer)(nil),
Methods: []grpc.MethodDesc{ Methods: []grpc.MethodDesc{
{ {
MethodName: "Echo", MethodName: "Echo",
Handler: _TMSPApplication_Echo_Handler,
Handler: _ABCIApplication_Echo_Handler,
}, },
{ {
MethodName: "Flush", MethodName: "Flush",
Handler: _TMSPApplication_Flush_Handler,
Handler: _ABCIApplication_Flush_Handler,
}, },
{ {
MethodName: "Info", MethodName: "Info",
Handler: _TMSPApplication_Info_Handler,
Handler: _ABCIApplication_Info_Handler,
}, },
{ {
MethodName: "SetOption", MethodName: "SetOption",
Handler: _TMSPApplication_SetOption_Handler,
Handler: _ABCIApplication_SetOption_Handler,
}, },
{ {
MethodName: "AppendTx",
Handler: _TMSPApplication_AppendTx_Handler,
MethodName: "DeliverTx",
Handler: _ABCIApplication_DeliverTx_Handler,
}, },
{ {
MethodName: "CheckTx", MethodName: "CheckTx",
Handler: _TMSPApplication_CheckTx_Handler,
Handler: _ABCIApplication_CheckTx_Handler,
}, },
{ {
MethodName: "Query", MethodName: "Query",
Handler: _TMSPApplication_Query_Handler,
Handler: _ABCIApplication_Query_Handler,
}, },
{ {
MethodName: "Commit", MethodName: "Commit",
Handler: _TMSPApplication_Commit_Handler,
Handler: _ABCIApplication_Commit_Handler,
}, },
{ {
MethodName: "InitChain", MethodName: "InitChain",
Handler: _TMSPApplication_InitChain_Handler,
Handler: _ABCIApplication_InitChain_Handler,
}, },
{ {
MethodName: "BeginBlock", MethodName: "BeginBlock",
Handler: _TMSPApplication_BeginBlock_Handler,
Handler: _ABCIApplication_BeginBlock_Handler,
}, },
{ {
MethodName: "EndBlock", MethodName: "EndBlock",
Handler: _TMSPApplication_EndBlock_Handler,
Handler: _ABCIApplication_EndBlock_Handler,
}, },
}, },
Streams: []grpc.StreamDesc{}, Streams: []grpc.StreamDesc{},


+ 8
- 8
types/types.proto View File

@ -1,7 +1,7 @@
syntax = "proto3"; syntax = "proto3";
package types; package types;
// This file is copied from http://github.com/tendermint/tmsp
// This file is copied from http://github.com/tendermint/abci
//---------------------------------------- //----------------------------------------
// Message types // Message types
@ -18,7 +18,7 @@ enum MessageType {
Info = 0x03; Info = 0x03;
SetOption = 0x04; SetOption = 0x04;
Exception = 0x05; Exception = 0x05;
AppendTx = 0x11;
DeliverTx = 0x11;
CheckTx = 0x12; CheckTx = 0x12;
Commit = 0x13; Commit = 0x13;
Query = 0x14; Query = 0x14;
@ -79,7 +79,7 @@ message Request {
RequestFlush flush = 2; RequestFlush flush = 2;
RequestInfo info = 3; RequestInfo info = 3;
RequestSetOption set_option = 4; RequestSetOption set_option = 4;
RequestAppendTx append_tx = 5;
RequestDeliverTx deliver_tx = 5;
RequestCheckTx check_tx = 6; RequestCheckTx check_tx = 6;
RequestCommit commit = 7; RequestCommit commit = 7;
RequestQuery query = 8; RequestQuery query = 8;
@ -104,7 +104,7 @@ message RequestSetOption{
string value = 2; string value = 2;
} }
message RequestAppendTx{
message RequestDeliverTx{
bytes tx = 1; bytes tx = 1;
} }
@ -143,7 +143,7 @@ message Response {
ResponseFlush flush = 3; ResponseFlush flush = 3;
ResponseInfo info = 4; ResponseInfo info = 4;
ResponseSetOption set_option = 5; ResponseSetOption set_option = 5;
ResponseAppendTx append_tx = 6;
ResponseDeliverTx deliver_tx = 6;
ResponseCheckTx check_tx = 7; ResponseCheckTx check_tx = 7;
ResponseCommit commit = 8; ResponseCommit commit = 8;
ResponseQuery query = 9; ResponseQuery query = 9;
@ -175,7 +175,7 @@ message ResponseSetOption{
string log = 1; string log = 1;
} }
message ResponseAppendTx{
message ResponseDeliverTx{
CodeType code = 1; CodeType code = 1;
bytes data = 2; bytes data = 2;
string log = 3; string log = 3;
@ -243,12 +243,12 @@ message Validator {
//---------------------------------------- //----------------------------------------
// Service Definition // Service Definition
service TMSPApplication {
service ABCIApplication {
rpc Echo(RequestEcho) returns (ResponseEcho) ; rpc Echo(RequestEcho) returns (ResponseEcho) ;
rpc Flush(RequestFlush) returns (ResponseFlush); rpc Flush(RequestFlush) returns (ResponseFlush);
rpc Info(RequestInfo) returns (ResponseInfo); rpc Info(RequestInfo) returns (ResponseInfo);
rpc SetOption(RequestSetOption) returns (ResponseSetOption); rpc SetOption(RequestSetOption) returns (ResponseSetOption);
rpc AppendTx(RequestAppendTx) returns (ResponseAppendTx);
rpc DeliverTx(RequestDeliverTx) returns (ResponseDeliverTx);
rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx); rpc CheckTx(RequestCheckTx) returns (ResponseCheckTx);
rpc Query(RequestQuery) returns (ResponseQuery); rpc Query(RequestQuery) returns (ResponseQuery);
rpc Commit(RequestCommit) returns (ResponseCommit); rpc Commit(RequestCommit) returns (ResponseCommit);


Loading…
Cancel
Save