TMSP -> ABCI
This commit is contained in:
parent
80f377135b
commit
5189a2248d
4
Makefile
4
Makefile
|
@ -2,13 +2,13 @@
|
|||
|
||||
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 --go_out=plugins=grpc:. types/*.proto
|
||||
|
||||
install:
|
||||
go install github.com/tendermint/tmsp/cmd/...
|
||||
go install github.com/tendermint/abci/cmd/...
|
||||
|
||||
test:
|
||||
go test `${NOVENDOR}`
|
||||
|
|
32
README.md
32
README.md
|
@ -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.
|
||||
**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.
|
||||
|
||||
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:
|
||||
* [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
|
||||
|
||||
This repository holds a number of important pieces:
|
||||
|
||||
- `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`
|
||||
- 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:
|
||||
- asynchronous, ordered message passing over unix or tcp;
|
||||
- messages are serialized using protobuf and length prefixed
|
||||
- grpc
|
||||
- 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:
|
||||
- the `cmd/counter` application, which illustrates nonce checking in txs
|
||||
|
@ -42,13 +42,13 @@ 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.
|
||||
|
||||
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.
|
||||
|
||||
## 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).
|
||||
|
||||
#### DeliverTx
|
||||
* __Arguments__:
|
||||
|
@ -148,7 +148,7 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil
|
|||
|
||||
##### Jan 23th, 2016
|
||||
|
||||
* Added CheckTx/Query TMSP message types
|
||||
* Added CheckTx/Query ABCI message types
|
||||
* Added Result/Log fields to DeliverTx/CheckTx/SetOption
|
||||
* Removed Listener messages
|
||||
* Removed Code from ResponseSetOption and ResponseGetHash
|
||||
|
@ -160,4 +160,4 @@ TMSP requests/responses are simple Protobuf messages. Check out the [schema fil
|
|||
|
||||
##### Jan 8th, 2016
|
||||
|
||||
* Tendermint/TMSP now comes to consensus on the order first before DeliverTx.
|
||||
* Tendermint/ABCI now comes to consensus on the order first before DeliverTx.
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
package tmspcli
|
||||
package abcicli
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type Client interface {
|
||||
|
@ -50,7 +50,7 @@ func NewClient(addr, transport string, mustConnect bool) (client Client, err err
|
|||
case "grpc":
|
||||
client, err = NewGRPCClient(addr, mustConnect)
|
||||
default:
|
||||
err = fmt.Errorf("Unknown tmsp transport %s", transport)
|
||||
err = fmt.Errorf("Unknown abci transport %s", transport)
|
||||
|
||||
}
|
||||
return
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package tmspcli
|
||||
package abcicli
|
||||
|
||||
import (
|
||||
"net"
|
||||
|
@ -9,7 +9,7 @@ import (
|
|||
grpc "google.golang.org/grpc"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
// A stripped copy of the remoteClient that makes
|
||||
|
@ -18,7 +18,7 @@ type grpcClient struct {
|
|||
BaseService
|
||||
mustConnect bool
|
||||
|
||||
client types.TMSPApplicationClient
|
||||
client types.ABCIApplicationClient
|
||||
|
||||
mtx sync.Mutex
|
||||
addr string
|
||||
|
@ -50,13 +50,13 @@ RETRY_LOOP:
|
|||
if cli.mustConnect {
|
||||
return err
|
||||
} 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)
|
||||
continue RETRY_LOOP
|
||||
}
|
||||
}
|
||||
|
||||
client := types.NewTMSPApplicationClient(conn)
|
||||
client := types.NewABCIApplicationClient(conn)
|
||||
|
||||
ENSURE_CONNECTED:
|
||||
for {
|
||||
|
@ -93,7 +93,7 @@ func (cli *grpcClient) StopForError(err error) {
|
|||
}
|
||||
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()
|
||||
}
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package tmspcli
|
||||
package abcicli
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
types "github.com/tendermint/tmsp/types"
|
||||
types "github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type localClient struct {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package tmspcli
|
||||
package abcicli
|
||||
|
||||
import (
|
||||
"github.com/tendermint/go-logger"
|
||||
)
|
||||
|
||||
var log = logger.New("module", "tmspcli")
|
||||
var log = logger.New("module", "abcicli")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package tmspcli
|
||||
package abcicli
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
|
@ -11,7 +11,7 @@ import (
|
|||
"time"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -70,7 +70,7 @@ RETRY_LOOP:
|
|||
if cli.mustConnect {
|
||||
return err
|
||||
} 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)
|
||||
continue RETRY_LOOP
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func (cli *socketClient) StopForError(err error) {
|
|||
}
|
||||
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()
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,8 @@ import (
|
|||
"strings"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/client"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/client"
|
||||
"github.com/tendermint/abci/types"
|
||||
"github.com/urfave/cli"
|
||||
)
|
||||
|
||||
|
@ -40,7 +40,7 @@ func newResponse(res types.Result, data string, printCode bool) *response {
|
|||
}
|
||||
|
||||
// client is a global variable so it can be reused by the console
|
||||
var client tmspcli.Client
|
||||
var client abcicli.Client
|
||||
|
||||
func main() {
|
||||
|
||||
|
@ -48,8 +48,8 @@ func main() {
|
|||
cli.OsExiter = func(_ int) {}
|
||||
|
||||
app := cli.NewApp()
|
||||
app.Name = "tmsp-cli"
|
||||
app.Usage = "tmsp-cli [command] [args...]"
|
||||
app.Name = "abci-cli"
|
||||
app.Usage = "abci-cli [command] [args...]"
|
||||
app.Version = "0.2.1" // better error handling in console
|
||||
app.Flags = []cli.Flag{
|
||||
cli.StringFlag{
|
||||
|
@ -58,7 +58,7 @@ func main() {
|
|||
Usage: "address of application socket",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "tmsp",
|
||||
Name: "abci",
|
||||
Value: "socket",
|
||||
Usage: "socket or grpc",
|
||||
},
|
||||
|
@ -70,14 +70,14 @@ func main() {
|
|||
app.Commands = []cli.Command{
|
||||
{
|
||||
Name: "batch",
|
||||
Usage: "Run a batch of tmsp commands against an application",
|
||||
Usage: "Run a batch of abci commands against an application",
|
||||
Action: func(c *cli.Context) error {
|
||||
return cmdBatch(app, c)
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: "console",
|
||||
Usage: "Start an interactive tmsp console for multiple commands",
|
||||
Usage: "Start an interactive abci console for multiple commands",
|
||||
Action: func(c *cli.Context) error {
|
||||
return cmdConsole(app, c)
|
||||
},
|
||||
|
@ -143,7 +143,7 @@ func main() {
|
|||
func before(c *cli.Context) error {
|
||||
if client == nil {
|
||||
var err error
|
||||
client, err = tmspcli.NewClient(c.GlobalString("address"), c.GlobalString("tmsp"), false)
|
||||
client, err = abcicli.NewClient(c.GlobalString("address"), c.GlobalString("abci"), false)
|
||||
if err != nil {
|
||||
Exit(err.Error())
|
||||
}
|
|
@ -4,20 +4,20 @@ import (
|
|||
"flag"
|
||||
|
||||
. "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() {
|
||||
|
||||
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")
|
||||
flag.Parse()
|
||||
app := counter.NewCounterApplication(*serialPtr)
|
||||
|
||||
// Start the listener
|
||||
srv, err := server.NewServer(*addrPtr, *tmspPtr, app)
|
||||
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
|
||||
if err != nil {
|
||||
Exit(err.Error())
|
||||
}
|
||||
|
|
|
@ -4,15 +4,15 @@ import (
|
|||
"flag"
|
||||
|
||||
. "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() {
|
||||
|
||||
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")
|
||||
flag.Parse()
|
||||
|
||||
|
@ -25,7 +25,7 @@ func main() {
|
|||
}
|
||||
|
||||
// Start the listener
|
||||
srv, err := server.NewServer(*addrPtr, *tmspPtr, app)
|
||||
srv, err := server.NewServer(*addrPtr, *abciPtr, app)
|
||||
if err != nil {
|
||||
Exit(err.Error())
|
||||
}
|
||||
|
|
|
@ -4,18 +4,18 @@ import (
|
|||
"flag"
|
||||
|
||||
. "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() {
|
||||
|
||||
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()
|
||||
|
||||
// Start the listener
|
||||
srv, err := server.NewServer(*addrPtr, *tmspPtr, NewChainAwareApplication())
|
||||
srv, err := server.NewServer(*addrPtr, *abciPtr, NewChainAwareApplication())
|
||||
if err != nil {
|
||||
Exit(err.Error())
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import (
|
|||
"testing"
|
||||
|
||||
. "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) {
|
||||
|
@ -23,7 +23,7 @@ func TestChainAware(t *testing.T) {
|
|||
defer srv.Stop()
|
||||
|
||||
// Connect to the socket
|
||||
client, err := tmspcli.NewSocketClient("unix://test.sock", false)
|
||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||
if err != nil {
|
||||
Exit(Fmt("Error starting socket client: %v", err.Error()))
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"encoding/binary"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type CounterApplication struct {
|
||||
|
|
|
@ -14,7 +14,7 @@ The app has no replay protection (other than what the mempool provides).
|
|||
The PersistentDummyApplication wraps the DummyApplication
|
||||
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
|
||||
|
||||
The state is persisted in leveldb along with the last block committed,
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type DummyApplication struct {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/go-crypto"
|
||||
"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) {
|
||||
|
@ -49,7 +49,7 @@ func TestDummyKV(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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ func TestPersistentDummyKV(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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ func TestPersistentDummyInfo(t *testing.T) {
|
|||
|
||||
// add a validator, remove a validator, update a validator
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
dbm "github.com/tendermint/go-db"
|
||||
"github.com/tendermint/go-merkle"
|
||||
"github.com/tendermint/go-wire"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
const (
|
||||
|
|
|
@ -11,11 +11,11 @@ import (
|
|||
"google.golang.org/grpc"
|
||||
|
||||
. "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) {
|
||||
|
@ -45,7 +45,7 @@ func testStream(t *testing.T, app types.Application) {
|
|||
defer server.Stop()
|
||||
|
||||
// Connect to the socket
|
||||
client, err := tmspcli.NewSocketClient("unix://test.sock", false)
|
||||
client, err := abcicli.NewSocketClient("unix://test.sock", false)
|
||||
if err != nil {
|
||||
Exit(Fmt("Error starting socket client: %v", err.Error()))
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
|
|||
}
|
||||
defer conn.Close()
|
||||
|
||||
client := types.NewTMSPApplicationClient(conn)
|
||||
client := types.NewABCIApplicationClient(conn)
|
||||
|
||||
// Write requests
|
||||
for counter := 0; counter < numDeliverTxs; counter++ {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package nilapp
|
||||
|
||||
import (
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
type NilApplication struct {
|
||||
|
|
|
@ -13,7 +13,7 @@ message_types = {
|
|||
0x25: "rm_listener",
|
||||
}
|
||||
|
||||
# return the decoded arguments of tmsp messages
|
||||
# return the decoded arguments of abci messages
|
||||
|
||||
class RequestDecoder():
|
||||
|
|
@ -26,9 +26,9 @@ class Connection():
|
|||
raise IOError("dead connection")
|
||||
this.recBuf.write(data)
|
||||
|
||||
# TMSP server responds to messges by calling methods on the app
|
||||
# ABCI server responds to messges by calling methods on the app
|
||||
|
||||
class TMSPServer():
|
||||
class ABCIServer():
|
||||
|
||||
def __init__(self, app, port=5410):
|
||||
self.app = app
|
|
@ -1,8 +1,8 @@
|
|||
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():
|
||||
|
@ -75,8 +75,8 @@ if __name__ == '__main__':
|
|||
print "too many arguments"
|
||||
quit()
|
||||
|
||||
print 'TMSP Demo APP (Python)'
|
||||
print 'ABCI Demo APP (Python)'
|
||||
|
||||
app = CounterApplication()
|
||||
server = TMSPServer(app, port)
|
||||
server = ABCIServer(app, port)
|
||||
server.main_loop()
|
||||
|
|
|
@ -13,7 +13,7 @@ message_types = {
|
|||
0x25: "rm_listener",
|
||||
}
|
||||
|
||||
# return the decoded arguments of tmsp messages
|
||||
# return the decoded arguments of abci messages
|
||||
|
||||
class RequestDecoder():
|
||||
|
|
@ -29,9 +29,9 @@ class Connection():
|
|||
raise IOError("dead connection")
|
||||
this.recBuf.write(data)
|
||||
|
||||
# TMSP server responds to messges by calling methods on the app
|
||||
# ABCI server responds to messges by calling methods on the app
|
||||
|
||||
class TMSPServer():
|
||||
class ABCIServer():
|
||||
|
||||
def __init__(self, app, port=5410):
|
||||
self.app = app
|
|
@ -1,8 +1,8 @@
|
|||
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():
|
||||
|
@ -75,8 +75,8 @@ if __name__ == '__main__':
|
|||
print("too many arguments")
|
||||
quit()
|
||||
|
||||
print('TMSP Demo APP (Python)')
|
||||
print('ABCI Demo APP (Python)')
|
||||
|
||||
app = CounterApplication()
|
||||
server = TMSPServer(app, port)
|
||||
server = ABCIServer(app, port)
|
||||
server.main_loop()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package: github.com/tendermint/tmsp
|
||||
package: github.com/tendermint/abci
|
||||
import:
|
||||
- package: github.com/golang/protobuf
|
||||
subpackages:
|
||||
|
|
|
@ -7,7 +7,7 @@ import (
|
|||
"google.golang.org/grpc"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
// var maxNumberConnections = 2
|
||||
|
@ -20,10 +20,10 @@ type GRPCServer struct {
|
|||
listener net.Listener
|
||||
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)
|
||||
proto, addr := parts[0], parts[1]
|
||||
s := &GRPCServer{
|
||||
|
@ -32,7 +32,7 @@ func NewGRPCServer(protoAddr string, app types.TMSPApplicationServer) (Service,
|
|||
listener: nil,
|
||||
app: app,
|
||||
}
|
||||
s.BaseService = *NewBaseService(nil, "TMSPServer", s)
|
||||
s.BaseService = *NewBaseService(nil, "ABCIServer", s)
|
||||
_, err := s.Start() // Just start it
|
||||
return s, err
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ func (s *GRPCServer) OnStart() error {
|
|||
}
|
||||
s.listener = ln
|
||||
s.server = grpc.NewServer()
|
||||
types.RegisterTMSPApplicationServer(s.server, s.app)
|
||||
types.RegisterABCIApplicationServer(s.server, s.app)
|
||||
go s.server.Serve(s.listener)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -4,4 +4,4 @@ import (
|
|||
"github.com/tendermint/go-logger"
|
||||
)
|
||||
|
||||
var log = logger.New("module", "tmsp-server")
|
||||
var log = logger.New("module", "abci-server")
|
||||
|
|
|
@ -4,7 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
. "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) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
"sync"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
// var maxNumberConnections = 2
|
||||
|
@ -39,7 +39,7 @@ func NewSocketServer(protoAddr string, app types.Application) (Service, error) {
|
|||
app: app,
|
||||
conns: make(map[int]net.Conn),
|
||||
}
|
||||
s.BaseService = *NewBaseService(nil, "TMSPServer", s)
|
||||
s.BaseService = *NewBaseService(nil, "ABCIServer", s)
|
||||
_, err := s.Start() // Just start it
|
||||
return s, err
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import (
|
|||
//"encoding/hex"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -9,7 +9,7 @@ import (
|
|||
//"encoding/hex"
|
||||
|
||||
. "github.com/tendermint/go-common"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
|
@ -7,24 +7,24 @@ import (
|
|||
|
||||
. "github.com/tendermint/go-common"
|
||||
"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
|
||||
//outBuf := NewBufferCloser(nil)
|
||||
proc, err := process.StartProcess("tmsp_app",
|
||||
proc, err := process.StartProcess("abci_app",
|
||||
"",
|
||||
"bash",
|
||||
[]string{"-c", tmspApp},
|
||||
[]string{"-c", abciApp},
|
||||
nil,
|
||||
os.Stdout,
|
||||
)
|
||||
if err != nil {
|
||||
panic("running tmsp_app: " + err.Error())
|
||||
panic("running abci_app: " + err.Error())
|
||||
}
|
||||
|
||||
// TODO a better way to handle this?
|
||||
|
@ -33,16 +33,16 @@ func StartApp(tmspApp string) *process.Process {
|
|||
return proc
|
||||
}
|
||||
|
||||
func StartClient(tmspType string) tmspcli.Client {
|
||||
func StartClient(abciType string) abcicli.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 {
|
||||
panic("connecting to tmsp_app: " + err.Error())
|
||||
panic("connecting to abci_app: " + err.Error())
|
||||
}
|
||||
return client
|
||||
}
|
||||
|
||||
func SetOption(client tmspcli.Client, key, value string) {
|
||||
func SetOption(client abcicli.Client, key, value string) {
|
||||
res := client.SetOptionSync(key, value)
|
||||
_, _, log := res.Code, res.Data, res.Log
|
||||
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()
|
||||
_, data, log := res.Code, res.Data, res.Log
|
||||
if res.IsErr() {
|
||||
|
@ -62,7 +62,7 @@ func Commit(client tmspcli.Client, hashExp []byte) {
|
|||
}
|
||||
}
|
||||
|
||||
func DeliverTx(client tmspcli.Client, txBytes []byte, codeExp types.CodeType, dataExp []byte) {
|
||||
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
|
||||
if code != codeExp {
|
||||
|
@ -75,7 +75,7 @@ func DeliverTx(client tmspcli.Client, txBytes []byte, codeExp types.CodeType, da
|
|||
}
|
||||
}
|
||||
|
||||
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)
|
||||
code, data, log := res.Code, res.Data, res.Log
|
||||
if res.IsErr() {
|
||||
|
|
|
@ -4,15 +4,15 @@ import (
|
|||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
var tmspType string
|
||||
var abciType string
|
||||
|
||||
func init() {
|
||||
tmspType = os.Getenv("TMSP")
|
||||
if tmspType == "" {
|
||||
tmspType = "socket"
|
||||
abciType = os.Getenv("ABCI")
|
||||
if abciType == "" {
|
||||
abciType = "socket"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,15 +21,15 @@ func main() {
|
|||
}
|
||||
|
||||
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)
|
||||
client := StartClient(tmspType)
|
||||
client := StartClient(abciType)
|
||||
defer client.Stop()
|
||||
|
||||
SetOption(client, "serial", "on")
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
#! /bin/bash
|
||||
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
|
||||
|
||||
# test golang counter
|
||||
TMSP_APP="counter" go run *.go
|
||||
ABCI_APP="counter" go run *.go
|
||||
|
||||
# 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
|
||||
# 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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#! /bin/bash
|
||||
|
||||
cd $GOPATH/src/github.com/tendermint/abci
|
||||
|
||||
function testExample() {
|
||||
N=$1
|
||||
INPUT=$2
|
||||
|
@ -8,7 +10,7 @@ function testExample() {
|
|||
echo "Example $N"
|
||||
$APP &> /dev/null &
|
||||
sleep 2
|
||||
tmsp-cli --verbose batch < $INPUT > "${INPUT}.out.new"
|
||||
abci-cli --verbose batch < $INPUT > "${INPUT}.out.new"
|
||||
killall "$APP"
|
||||
|
||||
pre=`shasum < "${INPUT}.out"`
|
||||
|
@ -26,8 +28,8 @@ function testExample() {
|
|||
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 "PASS"
|
||||
|
|
|
@ -2,7 +2,7 @@ package testutil
|
|||
|
||||
import (
|
||||
"github.com/tendermint/go-crypto"
|
||||
"github.com/tendermint/tmsp/types"
|
||||
"github.com/tendermint/abci/types"
|
||||
)
|
||||
|
||||
//----------------------------------------
|
||||
|
|
|
@ -28,7 +28,7 @@ func (res Result) IsErr() bool {
|
|||
}
|
||||
|
||||
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 {
|
||||
|
|
|
@ -1676,9 +1676,9 @@ var _ grpc.ClientConn
|
|||
// is compatible with the grpc package it is being compiled against.
|
||||
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)
|
||||
Flush(ctx context.Context, in *RequestFlush, opts ...grpc.CallOption) (*ResponseFlush, error)
|
||||
Info(ctx context.Context, in *RequestInfo, opts ...grpc.CallOption) (*ResponseInfo, error)
|
||||
|
@ -1696,13 +1696,13 @@ type tMSPApplicationClient struct {
|
|||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewTMSPApplicationClient(cc *grpc.ClientConn) TMSPApplicationClient {
|
||||
func NewABCIApplicationClient(cc *grpc.ClientConn) ABCIApplicationClient {
|
||||
return &tMSPApplicationClient{cc}
|
||||
}
|
||||
|
||||
func (c *tMSPApplicationClient) Echo(ctx context.Context, in *RequestEcho, opts ...grpc.CallOption) (*ResponseEcho, error) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1729,7 +1729,7 @@ func (c *tMSPApplicationClient) Info(ctx context.Context, in *RequestInfo, opts
|
|||
|
||||
func (c *tMSPApplicationClient) SetOption(ctx context.Context, in *RequestSetOption, opts ...grpc.CallOption) (*ResponseSetOption, error) {
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1738,7 +1738,7 @@ func (c *tMSPApplicationClient) SetOption(ctx context.Context, in *RequestSetOpt
|
|||
|
||||
func (c *tMSPApplicationClient) DeliverTx(ctx context.Context, in *RequestDeliverTx, opts ...grpc.CallOption) (*ResponseDeliverTx, error) {
|
||||
out := new(ResponseDeliverTx)
|
||||
err := grpc.Invoke(ctx, "/types.TMSPApplication/DeliverTx", in, out, c.cc, opts...)
|
||||
err := grpc.Invoke(ctx, "/types.ABCIApplication/DeliverTx", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1747,7 +1747,7 @@ func (c *tMSPApplicationClient) DeliverTx(ctx context.Context, in *RequestDelive
|
|||
|
||||
func (c *tMSPApplicationClient) CheckTx(ctx context.Context, in *RequestCheckTx, opts ...grpc.CallOption) (*ResponseCheckTx, error) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
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) {
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -1792,16 +1792,16 @@ func (c *tMSPApplicationClient) BeginBlock(ctx context.Context, in *RequestBegin
|
|||
|
||||
func (c *tMSPApplicationClient) EndBlock(ctx context.Context, in *RequestEndBlock, opts ...grpc.CallOption) (*ResponseEndBlock, error) {
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
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)
|
||||
Flush(context.Context, *RequestFlush) (*ResponseFlush, error)
|
||||
Info(context.Context, *RequestInfo) (*ResponseInfo, error)
|
||||
|
@ -1815,255 +1815,255 @@ type TMSPApplicationServer interface {
|
|||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).Echo(ctx, in)
|
||||
return srv.(ABCIApplicationServer).Echo(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/Echo",
|
||||
FullMethod: "/types.ABCIApplication/Echo",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).Flush(ctx, in)
|
||||
return srv.(ABCIApplicationServer).Flush(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/Flush",
|
||||
FullMethod: "/types.ABCIApplication/Flush",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).Info(ctx, in)
|
||||
return srv.(ABCIApplicationServer).Info(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/Info",
|
||||
FullMethod: "/types.ABCIApplication/Info",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).SetOption(ctx, in)
|
||||
return srv.(ABCIApplicationServer).SetOption(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/SetOption",
|
||||
FullMethod: "/types.ABCIApplication/SetOption",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
func _TMSPApplication_DeliverTx_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
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 {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).DeliverTx(ctx, in)
|
||||
return srv.(ABCIApplicationServer).DeliverTx(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/DeliverTx",
|
||||
FullMethod: "/types.ABCIApplication/DeliverTx",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(TMSPApplicationServer).DeliverTx(ctx, req.(*RequestDeliverTx))
|
||||
return srv.(ABCIApplicationServer).DeliverTx(ctx, req.(*RequestDeliverTx))
|
||||
}
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).CheckTx(ctx, in)
|
||||
return srv.(ABCIApplicationServer).CheckTx(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/CheckTx",
|
||||
FullMethod: "/types.ABCIApplication/CheckTx",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).Query(ctx, in)
|
||||
return srv.(ABCIApplicationServer).Query(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/Query",
|
||||
FullMethod: "/types.ABCIApplication/Query",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).Commit(ctx, in)
|
||||
return srv.(ABCIApplicationServer).Commit(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/Commit",
|
||||
FullMethod: "/types.ABCIApplication/Commit",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).InitChain(ctx, in)
|
||||
return srv.(ABCIApplicationServer).InitChain(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/InitChain",
|
||||
FullMethod: "/types.ABCIApplication/InitChain",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).BeginBlock(ctx, in)
|
||||
return srv.(ABCIApplicationServer).BeginBlock(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/BeginBlock",
|
||||
FullMethod: "/types.ABCIApplication/BeginBlock",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(TMSPApplicationServer).EndBlock(ctx, in)
|
||||
return srv.(ABCIApplicationServer).EndBlock(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/types.TMSPApplication/EndBlock",
|
||||
FullMethod: "/types.ABCIApplication/EndBlock",
|
||||
}
|
||||
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)
|
||||
}
|
||||
|
||||
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{
|
||||
{
|
||||
MethodName: "Echo",
|
||||
Handler: _TMSPApplication_Echo_Handler,
|
||||
Handler: _ABCIApplication_Echo_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Flush",
|
||||
Handler: _TMSPApplication_Flush_Handler,
|
||||
Handler: _ABCIApplication_Flush_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Info",
|
||||
Handler: _TMSPApplication_Info_Handler,
|
||||
Handler: _ABCIApplication_Info_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "SetOption",
|
||||
Handler: _TMSPApplication_SetOption_Handler,
|
||||
Handler: _ABCIApplication_SetOption_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "DeliverTx",
|
||||
Handler: _TMSPApplication_DeliverTx_Handler,
|
||||
Handler: _ABCIApplication_DeliverTx_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "CheckTx",
|
||||
Handler: _TMSPApplication_CheckTx_Handler,
|
||||
Handler: _ABCIApplication_CheckTx_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Query",
|
||||
Handler: _TMSPApplication_Query_Handler,
|
||||
Handler: _ABCIApplication_Query_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "Commit",
|
||||
Handler: _TMSPApplication_Commit_Handler,
|
||||
Handler: _ABCIApplication_Commit_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "InitChain",
|
||||
Handler: _TMSPApplication_InitChain_Handler,
|
||||
Handler: _ABCIApplication_InitChain_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "BeginBlock",
|
||||
Handler: _TMSPApplication_BeginBlock_Handler,
|
||||
Handler: _ABCIApplication_BeginBlock_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "EndBlock",
|
||||
Handler: _TMSPApplication_EndBlock_Handler,
|
||||
Handler: _ABCIApplication_EndBlock_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
syntax = "proto3";
|
||||
package types;
|
||||
|
||||
// This file is copied from http://github.com/tendermint/tmsp
|
||||
// This file is copied from http://github.com/tendermint/abci
|
||||
|
||||
//----------------------------------------
|
||||
// Message types
|
||||
|
@ -243,7 +243,7 @@ message Validator {
|
|||
//----------------------------------------
|
||||
// Service Definition
|
||||
|
||||
service TMSPApplication {
|
||||
service ABCIApplication {
|
||||
rpc Echo(RequestEcho) returns (ResponseEcho) ;
|
||||
rpc Flush(RequestFlush) returns (ResponseFlush);
|
||||
rpc Info(RequestInfo) returns (ResponseInfo);
|
||||
|
|
Loading…
Reference in New Issue