diff --git a/.gitignore b/.gitignore index d2d414be..920af762 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.swp *.swo *.pyc +vendor diff --git a/Makefile b/Makefile index 45d0450a..31236551 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,10 @@ all: protoc install test NOVENDOR = go list github.com/tendermint/abci/... | grep -v /vendor/ +install-protoc: + # Download: https://github.com/google/protobuf/releases + go get github.com/golang/protobuf/protoc-gen-go + protoc: @ protoc --go_out=plugins=grpc:. types/*.proto @@ -13,8 +17,10 @@ install: build: @ go build -i github.com/tendermint/abci/cmd/... -test: - @ go test `${NOVENDOR}` +# test.sh requires that we run the installed cmds, must not be out of date +test: install + find . -name test.sock -exec rm {} \; + @ go test -p 1 `${NOVENDOR}` @ bash tests/test.sh fmt: diff --git a/README.md b/README.md index b73724e6..c002b141 100644 --- a/README.md +++ b/README.md @@ -21,51 +21,16 @@ Other implementations: The [primary specification](https://github.com/tendermint/abci/blob/master/types/types.proto) is made using Protocol Buffers. -As a [Go interface](https://github.com/tendermint/abci/blob/master/types/application.go), it might look like: + - 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. +TendermintCore runs a client, and the ABCI application runs a server. There are three Golang implementation of ABCI client and server. -``` -// Applications -type Application interface { +1. ABCI-socket: Asynchronous, ordered message passing over Unix or TCP sockets. Messages are serialized using Protobuf and length prefixed. +2. GRPC: Synchronous (slow) implementation using GRPC. +3. Golang in-process: If the ABCI appliation is written in Golang, it is possible to compile both TendermintCore and the application as one binary. - // Latest state - Info() ResponseInfo - - // Initialization - SetOption(key string, value string) (log string) - InitChain(validators []*Validator) - - // Apply a block - BeginBlock(hash []byte, header *Header) - DeliverTx(tx []byte) Result - EndBlock(height uint64) ResponseEndBlock - Commit() Result - - // Check validity - CheckTx(tx []byte) Result - - // Query for state - Query(query []byte) Result -} - -type Result struct { - Code CodeType - Data []byte - Log string // Can be non-deterministic -} - -type ResponseInfo struct { - Data string - Version string - LastBlockHeight uint64 - LastBlockAppHash []byte -} - -type ResponseEndBlock struct { - Diffs []*Validator -} - -``` +_TODO: merge information from https://tendermint.com/blog/tendermint-0-8-release_ ## Message Types @@ -98,7 +63,7 @@ ABCI requests/responses are simple Protobuf messages. Check out the [schema fil You can make CheckTx semi-stateful and clear the state upon `Commit` or `BeginBlock`, to allow for dependent sequences of transactions in the same block. -#### Commit +#### Commit * __Returns__: * `Data ([]byte)`: The Merkle root hash * `Log (string)`: Debug or error message @@ -107,11 +72,20 @@ ABCI requests/responses are simple Protobuf messages. Check out the [schema fil #### Query * __Arguments__: - * `Data ([]byte)`: The query request bytes + * `Data ([]byte)`: Raw query bytes. Can be used with or in lieu of Path. + * `Path (string)`: Path of request, like an HTTP GET path. Can be used with or in liue of Data. + * Apps MUST interpret '/store' as a query by key on the underlying store. The key SHOULD be specified in the Data field. + * Apps SHOULD allow queries over specific types like '/accounts/...' or '/votes/...' + * `Height (uint64)`: The block height for which you want the query (default=0 returns data for the latest committed block) + * `Prove (bool)`: Return Merkle proof with response if possible * __Returns__: * `Code (uint32)`: Response code - * `Data ([]byte)`: The query response bytes + * `Key ([]byte)`: The key of the matching data + * `Value ([]byte)`: The value of the matching data + * `Proof ([]byte)`: Proof for the data, if requested + * `Height (uint64)`: The block height from which data was derived * `Log (string)`: Debug or error message + *Please note* The current implementation of go-merkle doesn't support querying proofs from past blocks, so for the present moment, any height other than 0 will return an error. Hopefully this will be improved soon(ish) #### Info * __Returns__: diff --git a/client/client.go b/client/client.go index 9b3d1a75..38fff486 100644 --- a/client/client.go +++ b/client/client.go @@ -20,7 +20,7 @@ type Client interface { SetOptionAsync(key string, value string) *ReqRes DeliverTxAsync(tx []byte) *ReqRes CheckTxAsync(tx []byte) *ReqRes - QueryAsync(tx []byte) *ReqRes + QueryAsync(reqQuery types.RequestQuery) *ReqRes CommitAsync() *ReqRes FlushSync() error @@ -29,7 +29,7 @@ type Client interface { SetOptionSync(key string, value string) (res types.Result) DeliverTxSync(tx []byte) (res types.Result) CheckTxSync(tx []byte) (res types.Result) - QuerySync(tx []byte) (res types.Result) + QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error) CommitSync() (res types.Result) InitChainAsync(validators []*types.Validator) *ReqRes diff --git a/client/grpc_client.go b/client/grpc_client.go index fc67b8b9..7cca5079 100644 --- a/client/grpc_client.go +++ b/client/grpc_client.go @@ -173,8 +173,8 @@ func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes { return cli.finishAsyncCall(req, &types.Response{&types.Response_CheckTx{res}}) } -func (cli *grpcClient) QueryAsync(query []byte) *ReqRes { - req := types.ToRequestQuery(query) +func (cli *grpcClient) QueryAsync(reqQuery types.RequestQuery) *ReqRes { + req := types.ToRequestQuery(reqQuery) res, err := cli.client.Query(context.Background(), req.GetQuery(), grpc.FailFast(true)) if err != nil { cli.StopForError(err) @@ -255,7 +255,7 @@ func (cli *grpcClient) EchoSync(msg string) (res types.Result) { return res } resp := reqres.Response.GetEcho() - return types.NewResultOK([]byte(resp.Message), LOG) + return types.NewResultOK([]byte(resp.Message), "") } func (cli *grpcClient) FlushSync() error { @@ -300,13 +300,15 @@ func (cli *grpcClient) CheckTxSync(tx []byte) (res types.Result) { return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log} } -func (cli *grpcClient) QuerySync(query []byte) (res types.Result) { - reqres := cli.QueryAsync(query) - if res := cli.checkErrGetResult(); res.IsErr() { - return res +func (cli *grpcClient) QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error) { + reqres := cli.QueryAsync(reqQuery) + if err = cli.Error(); err != nil { + return resQuery, err } - resp := reqres.Response.GetQuery() - return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log} + if resQuery_ := reqres.Response.GetQuery(); resQuery_ != nil { + return *resQuery_, nil + } + return resQuery, nil } func (cli *grpcClient) CommitSync() (res types.Result) { diff --git a/client/local_client.go b/client/local_client.go index 459f4223..a34fde10 100644 --- a/client/local_client.go +++ b/client/local_client.go @@ -89,13 +89,13 @@ func (app *localClient) CheckTxAsync(tx []byte) *ReqRes { ) } -func (app *localClient) QueryAsync(tx []byte) *ReqRes { +func (app *localClient) QueryAsync(reqQuery types.RequestQuery) *ReqRes { app.mtx.Lock() - res := app.Application.Query(tx) + resQuery := app.Application.Query(reqQuery) app.mtx.Unlock() return app.callback( - types.ToRequestQuery(tx), - types.ToResponseQuery(res.Code, res.Data, res.Log), + types.ToRequestQuery(reqQuery), + types.ToResponseQuery(resQuery), ) } @@ -185,11 +185,11 @@ func (app *localClient) CheckTxSync(tx []byte) (res types.Result) { return res } -func (app *localClient) QuerySync(query []byte) (res types.Result) { +func (app *localClient) QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error) { app.mtx.Lock() - res = app.Application.Query(query) + resQuery = app.Application.Query(reqQuery) app.mtx.Unlock() - return res + return resQuery, nil } func (app *localClient) CommitSync() (res types.Result) { diff --git a/client/socket_client.go b/client/socket_client.go index d5335d8e..5aeeac7a 100644 --- a/client/socket_client.go +++ b/client/socket_client.go @@ -249,8 +249,8 @@ func (cli *socketClient) CheckTxAsync(tx []byte) *ReqRes { return cli.queueRequest(types.ToRequestCheckTx(tx)) } -func (cli *socketClient) QueryAsync(query []byte) *ReqRes { - return cli.queueRequest(types.ToRequestQuery(query)) +func (cli *socketClient) QueryAsync(reqQuery types.RequestQuery) *ReqRes { + return cli.queueRequest(types.ToRequestQuery(reqQuery)) } func (cli *socketClient) CommitAsync() *ReqRes { @@ -278,7 +278,7 @@ func (cli *socketClient) EchoSync(msg string) (res types.Result) { return types.ErrInternalError.SetLog(err.Error()) } resp := reqres.Response.GetEcho() - return types.Result{Code: OK, Data: []byte(resp.Message), Log: LOG} + return types.Result{Code: OK, Data: []byte(resp.Message)} } func (cli *socketClient) FlushSync() error { @@ -296,8 +296,8 @@ func (cli *socketClient) InfoSync() (resInfo types.ResponseInfo, err error) { if err := cli.Error(); err != nil { return resInfo, err } - if info := reqres.Response.GetInfo(); info != nil { - return *info, nil + if resInfo_ := reqres.Response.GetInfo(); resInfo_ != nil { + return *resInfo_, nil } return resInfo, nil } @@ -332,14 +332,16 @@ func (cli *socketClient) CheckTxSync(tx []byte) (res types.Result) { return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log} } -func (cli *socketClient) QuerySync(query []byte) (res types.Result) { - reqres := cli.queueRequest(types.ToRequestQuery(query)) +func (cli *socketClient) QuerySync(reqQuery types.RequestQuery) (resQuery types.ResponseQuery, err error) { + reqres := cli.queueRequest(types.ToRequestQuery(reqQuery)) cli.FlushSync() if err := cli.Error(); err != nil { - return types.ErrInternalError.SetLog(err.Error()) + return resQuery, err } - resp := reqres.Response.GetQuery() - return types.Result{Code: resp.Code, Data: resp.Data, Log: resp.Log} + if resQuery_ := reqres.Response.GetQuery(); resQuery_ != nil { + return *resQuery_, nil + } + return resQuery, nil } func (cli *socketClient) CommitSync() (res types.Result) { diff --git a/cmd/abci-cli/tmsp-cli.go b/cmd/abci-cli/abci-cli.go similarity index 79% rename from cmd/abci-cli/tmsp-cli.go rename to cmd/abci-cli/abci-cli.go index a5e32d0e..0168bea4 100644 --- a/cmd/abci-cli/tmsp-cli.go +++ b/cmd/abci-cli/abci-cli.go @@ -15,28 +15,15 @@ import ( "github.com/urfave/cli" ) -//structure for data passed to print response -// variables must be exposed for JSON to read +// Structure for data passed to print response. type response struct { - Res types.Result - Data string - PrintCode bool - Code string -} - -func newResponse(res types.Result, data string, printCode bool) *response { - rsp := &response{ - Res: res, - Data: data, - PrintCode: printCode, - Code: "", - } - - if printCode { - rsp.Code = res.Code.String() - } - - return rsp + Data []byte + Code types.CodeType + Key []byte + Value []byte + Log string + Height string + Proof []byte } // client is a global variable so it can be reused by the console @@ -220,9 +207,10 @@ func cmdEcho(c *cli.Context) error { if len(args) != 1 { return errors.New("Command echo takes 1 argument") } - res := client.EchoSync(args[0]) - rsp := newResponse(res, string(res.Data), false) - printResponse(c, rsp) + resEcho := client.EchoSync(args[0]) + printResponse(c, response{ + Data: resEcho.Data, + }) return nil } @@ -232,8 +220,9 @@ func cmdInfo(c *cli.Context) error { if err != nil { return err } - rsp := newResponse(types.Result{}, string(resInfo.Data), false) - printResponse(c, rsp) + printResponse(c, response{ + Data: []byte(resInfo.Data), + }) return nil } @@ -243,9 +232,10 @@ func cmdSetOption(c *cli.Context) error { if len(args) != 2 { return errors.New("Command set_option takes 2 arguments (key, value)") } - res := client.SetOptionSync(args[0], args[1]) - rsp := newResponse(res, fmt.Sprintf("%s=%s", args[0], args[1]), false) - printResponse(c, rsp) + resSetOption := client.SetOptionSync(args[0], args[1]) + printResponse(c, response{ + Log: resSetOption.Log, + }) return nil } @@ -260,8 +250,11 @@ func cmdDeliverTx(c *cli.Context) error { return err } res := client.DeliverTxSync(txBytes) - rsp := newResponse(res, string(res.Data), true) - printResponse(c, rsp) + printResponse(c, response{ + Code: res.Code, + Data: res.Data, + Log: res.Log, + }) return nil } @@ -276,20 +269,26 @@ func cmdCheckTx(c *cli.Context) error { return err } res := client.CheckTxSync(txBytes) - rsp := newResponse(res, string(res.Data), true) - printResponse(c, rsp) + printResponse(c, response{ + Code: res.Code, + Data: res.Data, + Log: res.Log, + }) return nil } // Get application Merkle root hash func cmdCommit(c *cli.Context) error { res := client.CommitSync() - rsp := newResponse(res, fmt.Sprintf("0x%X", res.Data), false) - printResponse(c, rsp) + printResponse(c, response{ + Data: res.Data, + Log: res.Log, + }) return nil } // Query application state +// TODO: Make request and response support all fields. func cmdQuery(c *cli.Context) error { args := c.Args() if len(args) != 1 { @@ -299,15 +298,29 @@ func cmdQuery(c *cli.Context) error { if err != nil { return err } - res := client.QuerySync(queryBytes) - rsp := newResponse(res, string(res.Data), true) - printResponse(c, rsp) + resQuery, err := client.QuerySync(types.RequestQuery{ + Data: queryBytes, + Path: "/store", // TOOD expose + Height: 0, // TODO expose + //Prove: true, // TODO expose + }) + if err != nil { + return err + } + printResponse(c, response{ + Code: resQuery.Code, + Key: resQuery.Key, + Value: resQuery.Value, + Log: resQuery.Log, + Height: fmt.Sprintf("%v", resQuery.Height), + //Proof: resQuery.Proof, + }) return nil } //-------------------------------------------------------------------------------- -func printResponse(c *cli.Context, rsp *response) { +func printResponse(c *cli.Context, rsp response) { verbose := c.GlobalBool("verbose") @@ -315,19 +328,29 @@ func printResponse(c *cli.Context, rsp *response) { fmt.Println(">", c.Command.Name, strings.Join(c.Args(), " ")) } - if rsp.PrintCode { - fmt.Printf("-> code: %s\n", rsp.Code) + if rsp.Code != types.CodeType_OK { + fmt.Printf("-> code: %s\n", rsp.Code.String()) } - - //if pr.res.Error != "" { - // fmt.Printf("-> error: %s\n", pr.res.Error) - //} - - if rsp.Data != "" { + if len(rsp.Data) != 0 { fmt.Printf("-> data: %s\n", rsp.Data) + fmt.Printf("-> data.hex: %X\n", rsp.Data) } - if rsp.Res.Log != "" { - fmt.Printf("-> log: %s\n", rsp.Res.Log) + if len(rsp.Key) != 0 { + fmt.Printf("-> key: %s\n", rsp.Key) + fmt.Printf("-> key.hex: %X\n", rsp.Key) + } + if len(rsp.Value) != 0 { + fmt.Printf("-> value: %s\n", rsp.Value) + fmt.Printf("-> value.hex: %X\n", rsp.Value) + } + if rsp.Log != "" { + fmt.Printf("-> log: %s\n", rsp.Log) + } + if rsp.Height != "" { + fmt.Printf("-> height: %s\n", rsp.Height) + } + if rsp.Proof != nil { + fmt.Printf("-> proof: %X\n", rsp.Proof) } if verbose { diff --git a/example/chain_aware/chain_aware_app.go b/example/chain_aware/chain_aware_app.go index 766f570c..90a7a440 100644 --- a/example/chain_aware/chain_aware_app.go +++ b/example/chain_aware/chain_aware_app.go @@ -2,7 +2,6 @@ package main import ( "flag" - "fmt" "log" "github.com/tendermint/abci/server" @@ -59,8 +58,10 @@ func (app *ChainAwareApplication) Commit() types.Result { return types.NewResultOK([]byte("nil"), "") } -func (app *ChainAwareApplication) Query(query []byte) types.Result { - return types.NewResultOK([]byte(fmt.Sprintf("%d,%d", app.beginCount, app.endCount)), "") +func (app *ChainAwareApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) { + return types.ResponseQuery{ + Value: []byte(cmn.Fmt("%d,%d", app.beginCount, app.endCount)), + } } func (app *ChainAwareApplication) BeginBlock(hash []byte, header *types.Header) { diff --git a/example/chain_aware/chain_aware_test.go b/example/chain_aware/chain_aware_test.go index d3ece608..2ce6aacf 100644 --- a/example/chain_aware/chain_aware_test.go +++ b/example/chain_aware/chain_aware_test.go @@ -40,10 +40,10 @@ func TestChainAware(t *testing.T) { client.CommitSync() } - r := app.Query(nil) - spl := strings.Split(string(r.Data), ",") + r := app.Query(types.RequestQuery{}) + spl := strings.Split(string(r.Value), ",") if len(spl) != 2 { - t.Fatal("expected %d,%d ; got %s", n, n, string(r.Data)) + t.Fatal("expected %d,%d ; got %s", n, n, string(r.Value)) } beginCount, _ := strconv.Atoi(spl[0]) endCount, _ := strconv.Atoi(spl[1]) diff --git a/example/counter/counter.go b/example/counter/counter.go index 00e71f38..a55a1fd1 100644 --- a/example/counter/counter.go +++ b/example/counter/counter.go @@ -5,6 +5,7 @@ import ( "fmt" "github.com/tendermint/abci/types" + . "github.com/tendermint/go-common" ) type CounterApplication struct { @@ -69,15 +70,13 @@ func (app *CounterApplication) Commit() types.Result { return types.NewResultOK(hash, "") } -func (app *CounterApplication) Query(query []byte) types.Result { - queryStr := string(query) - - switch queryStr { +func (app *CounterApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery { + switch reqQuery.Path { case "hash": - return types.NewResultOK(nil, fmt.Sprintf("%v", app.hashCount)) + return types.ResponseQuery{Value: []byte(Fmt("%v", app.hashCount))} case "tx": - return types.NewResultOK(nil, fmt.Sprintf("%v", app.txCount)) + return types.ResponseQuery{Value: []byte(Fmt("%v", app.txCount))} + default: + return types.ResponseQuery{Log: Fmt("Invalid query path. Expected hash or tx, got %v", reqQuery.Path)} } - - return types.ErrUnknownRequest.SetLog(fmt.Sprintf("Invalid nonce. Expected hash or tx, got %v", queryStr)) } diff --git a/example/dummy/dummy.go b/example/dummy/dummy.go index b514e43c..ac2bd462 100644 --- a/example/dummy/dummy.go +++ b/example/dummy/dummy.go @@ -1,13 +1,11 @@ package dummy import ( - "encoding/hex" "fmt" "strings" "github.com/tendermint/abci/types" "github.com/tendermint/go-merkle" - "github.com/tendermint/go-wire" ) type DummyApplication struct { @@ -47,15 +45,28 @@ func (app *DummyApplication) Commit() types.Result { return types.NewResultOK(hash, "") } -func (app *DummyApplication) Query(query []byte) types.Result { - index, value, exists := app.state.Get(query) - queryResult := QueryResult{index, string(value), hex.EncodeToString(value), exists} - return types.NewResultOK(wire.JSONBytes(queryResult), "") -} - -type QueryResult struct { - Index int `json:"index"` - Value string `json:"value"` - ValueHex string `json:"valueHex"` - Exists bool `json:"exists"` +func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) { + if reqQuery.Prove { + value, proof, exists := app.state.Proof(reqQuery.Data) + resQuery.Index = -1 // TODO make Proof return index + resQuery.Key = reqQuery.Data + resQuery.Value = value + resQuery.Proof = proof + if exists { + resQuery.Log = "exists" + } else { + resQuery.Log = "does not exist" + } + return + } else { + index, value, exists := app.state.Get(reqQuery.Data) + resQuery.Index = int64(index) + resQuery.Value = value + if exists { + resQuery.Log = "exists" + } else { + resQuery.Log = "does not exist" + } + return + } } diff --git a/example/dummy/dummy_test.go b/example/dummy/dummy_test.go index 49dce920..7ca12a6e 100644 --- a/example/dummy/dummy_test.go +++ b/example/dummy/dummy_test.go @@ -7,34 +7,41 @@ import ( "sort" "testing" + "github.com/stretchr/testify/require" + abcicli "github.com/tendermint/abci/client" + "github.com/tendermint/abci/server" "github.com/tendermint/abci/types" cmn "github.com/tendermint/go-common" "github.com/tendermint/go-crypto" - "github.com/tendermint/go-wire" + merkle "github.com/tendermint/go-merkle" ) -func testDummy(t *testing.T, dummy types.Application, tx []byte, key, value string) { - if r := dummy.DeliverTx(tx); r.IsErr() { - t.Fatal(r) - } - if r := dummy.DeliverTx(tx); r.IsErr() { - t.Fatal(r) - } +func testDummy(t *testing.T, app types.Application, tx []byte, key, value string) { + ar := app.DeliverTx(tx) + require.False(t, ar.IsErr(), ar) + // repeating tx doesn't raise error + ar = app.DeliverTx(tx) + require.False(t, ar.IsErr(), ar) - r := dummy.Query([]byte(key)) - if r.IsErr() { - t.Fatal(r) - } - - q := new(QueryResult) - if err := wire.ReadJSONBytes(r.Data, q); err != nil { - t.Fatal(err) - } - - if q.Value != value { - t.Fatalf("Got %s, expected %s", q.Value, value) - } + // make sure query is fine + resQuery := app.Query(types.RequestQuery{ + Path: "/store", + Data: []byte(key), + }) + require.Equal(t, types.CodeType_OK, resQuery.Code) + require.Equal(t, value, string(resQuery.Value)) + // make sure proof is fine + resQuery = app.Query(types.RequestQuery{ + Path: "/store", + Data: []byte(key), + Prove: true, + }) + require.Equal(t, types.CodeType_OK, resQuery.Code) + require.Equal(t, value, string(resQuery.Value)) + proof, err := merkle.ReadProof(resQuery.Proof) + require.Nil(t, err) + require.True(t, proof.Verify([]byte(key), resQuery.Value, proof.RootHash)) // NOTE: we have no way to verify the RootHash } func TestDummyKV(t *testing.T) { @@ -202,3 +209,102 @@ func valsEqual(t *testing.T, vals1, vals2 []*types.Validator) { } } } + +func makeSocketClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) { + // Start the listener + socket := cmn.Fmt("unix://%s.sock", name) + server, err := server.NewSocketServer(socket, app) + if err != nil { + return nil, nil, err + } + + // Connect to the socket + client, err := abcicli.NewSocketClient(socket, false) + if err != nil { + server.Stop() + return nil, nil, err + } + client.Start() + + return client, server, err +} + +func makeGRPCClientServer(app types.Application, name string) (abcicli.Client, cmn.Service, error) { + // Start the listener + socket := cmn.Fmt("unix://%s.sock", name) + + gapp := types.NewGRPCApplication(app) + server, err := server.NewGRPCServer(socket, gapp) + if err != nil { + return nil, nil, err + } + + client, err := abcicli.NewGRPCClient(socket, true) + if err != nil { + server.Stop() + return nil, nil, err + } + return client, server, err +} + +func TestClientServer(t *testing.T) { + // set up socket app + dummy := NewDummyApplication() + client, server, err := makeSocketClientServer(dummy, "dummy-socket") + require.Nil(t, err) + defer server.Stop() + defer client.Stop() + + runClientTests(t, client) + + // set up grpc app + dummy = NewDummyApplication() + gclient, gserver, err := makeGRPCClientServer(dummy, "dummy-grpc") + require.Nil(t, err) + defer gserver.Stop() + defer gclient.Stop() + + runClientTests(t, gclient) +} + +func runClientTests(t *testing.T, client abcicli.Client) { + // run some tests.... + key := "abc" + value := key + tx := []byte(key) + testClient(t, client, tx, key, value) + + value = "def" + tx = []byte(key + "=" + value) + testClient(t, client, tx, key, value) +} + +func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string) { + ar := app.DeliverTxSync(tx) + require.False(t, ar.IsErr(), ar) + // repeating tx doesn't raise error + ar = app.DeliverTxSync(tx) + require.False(t, ar.IsErr(), ar) + + // make sure query is fine + resQuery, err := app.QuerySync(types.RequestQuery{ + Path: "/store", + Data: []byte(key), + }) + require.Nil(t, err) + require.Equal(t, types.CodeType_OK, resQuery.Code) + require.Equal(t, value, string(resQuery.Value)) + + // make sure proof is fine + resQuery, err = app.QuerySync(types.RequestQuery{ + Path: "/store", + Data: []byte(key), + Prove: true, + }) + require.Nil(t, err) + require.Equal(t, types.CodeType_OK, resQuery.Code) + require.Equal(t, value, string(resQuery.Value)) + proof, err := merkle.ReadProof(resQuery.Proof) + require.Nil(t, err) + require.True(t, proof.Verify([]byte(key), resQuery.Value, proof.RootHash)) // NOTE: we have no way to verify the RootHash +} diff --git a/example/dummy/dummy_test.go.orig b/example/dummy/dummy_test.go.orig new file mode 100644 index 00000000..5cf7eee7 --- /dev/null +++ b/example/dummy/dummy_test.go.orig @@ -0,0 +1,321 @@ +package dummy + +import ( + "bytes" + "io/ioutil" + "sort" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + . "github.com/tendermint/go-common" + "github.com/tendermint/go-crypto" + merkle "github.com/tendermint/go-merkle" + "github.com/tendermint/go-wire" +<<<<<<< HEAD + "github.com/tendermint/abci/types" +) + +func testDummy(t *testing.T, dummy types.Application, tx []byte, key, value string) { + if r := dummy.DeliverTx(tx); r.IsErr() { + t.Fatal(r) + } + if r := dummy.DeliverTx(tx); r.IsErr() { + t.Fatal(r) + } + + r := dummy.Query([]byte(key)) + if r.IsErr() { + t.Fatal(r) + } +======= + tmspcli "github.com/tendermint/tmsp/client" + "github.com/tendermint/tmsp/server" + "github.com/tendermint/tmsp/types" +) + +func testDummy(t *testing.T, app types.Application, tx []byte, key, value string) { + ar := app.AppendTx(tx) + require.False(t, ar.IsErr(), ar) + // repeating tx doesn't raise error + ar = app.AppendTx(tx) + require.False(t, ar.IsErr(), ar) +>>>>>>> Add tests for client-server proofs over socket and grpc + + // make sure query is fine + r := app.Query([]byte(key)) + require.False(t, r.IsErr(), r) + q := new(QueryResult) + err := wire.ReadJSONBytes(r.Data, q) + require.Nil(t, err) + require.Equal(t, value, q.Value) + + // make sure proof is fine + rp := app.Proof([]byte(key), 0) + require.False(t, rp.IsErr(), rp) + p, err := merkle.LoadProof(rp.Data) + require.Nil(t, err) + require.True(t, p.Valid()) + assert.Equal(t, []byte(key), p.Key()) + assert.Equal(t, []byte(value), p.Value()) +} + +func TestDummyKV(t *testing.T) { + dummy := NewDummyApplication() + key := "abc" + value := key + tx := []byte(key) + testDummy(t, dummy, tx, key, value) + + value = "def" + tx = []byte(key + "=" + value) + testDummy(t, dummy, tx, key, value) +} + +func TestPersistentDummyKV(t *testing.T) { + dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO + if err != nil { + t.Fatal(err) + } + dummy := NewPersistentDummyApplication(dir) + key := "abc" + value := key + tx := []byte(key) + testDummy(t, dummy, tx, key, value) + + value = "def" + tx = []byte(key + "=" + value) + testDummy(t, dummy, tx, key, value) +} + +func TestPersistentDummyInfo(t *testing.T) { + dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO + if err != nil { + t.Fatal(err) + } + dummy := NewPersistentDummyApplication(dir) + height := uint64(0) + + resInfo := dummy.Info() + if resInfo.LastBlockHeight != height { + t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight) + } + + // make and apply block + height = uint64(1) + hash := []byte("foo") + header := &types.Header{ + Height: uint64(height), + } + dummy.BeginBlock(hash, header) + dummy.EndBlock(height) + dummy.Commit() + + resInfo = dummy.Info() + if resInfo.LastBlockHeight != height { + t.Fatalf("expected height of %d, got %d", height, resInfo.LastBlockHeight) + } + +} + +// add a validator, remove a validator, update a validator +func TestValSetChanges(t *testing.T) { + dir, err := ioutil.TempDir("/tmp", "abci-dummy-test") // TODO + if err != nil { + t.Fatal(err) + } + dummy := NewPersistentDummyApplication(dir) + + // init with some validators + total := 10 + nInit := 5 + vals := make([]*types.Validator, total) + for i := 0; i < total; i++ { + pubkey := crypto.GenPrivKeyEd25519FromSecret([]byte(Fmt("test%d", i))).PubKey().Bytes() + power := RandInt() + vals[i] = &types.Validator{pubkey, uint64(power)} + } + // iniitalize with the first nInit + dummy.InitChain(vals[:nInit]) + + vals1, vals2 := vals[:nInit], dummy.Validators() + valsEqual(t, vals1, vals2) + + var v1, v2, v3 *types.Validator + + // add some validators + v1, v2 = vals[nInit], vals[nInit+1] + diff := []*types.Validator{v1, v2} + tx1 := MakeValSetChangeTx(v1.PubKey, v1.Power) + tx2 := MakeValSetChangeTx(v2.PubKey, v2.Power) + + makeApplyBlock(t, dummy, 1, diff, tx1, tx2) + + vals1, vals2 = vals[:nInit+2], dummy.Validators() + valsEqual(t, vals1, vals2) + + // remove some validators + v1, v2, v3 = vals[nInit-2], vals[nInit-1], vals[nInit] + v1.Power = 0 + v2.Power = 0 + v3.Power = 0 + diff = []*types.Validator{v1, v2, v3} + tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power) + tx2 = MakeValSetChangeTx(v2.PubKey, v2.Power) + tx3 := MakeValSetChangeTx(v3.PubKey, v3.Power) + + makeApplyBlock(t, dummy, 2, diff, tx1, tx2, tx3) + + vals1 = append(vals[:nInit-2], vals[nInit+1]) + vals2 = dummy.Validators() + valsEqual(t, vals1, vals2) + + // update some validators + v1 = vals[0] + if v1.Power == 5 { + v1.Power = 6 + } else { + v1.Power = 5 + } + diff = []*types.Validator{v1} + tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power) + + makeApplyBlock(t, dummy, 3, diff, tx1) + + vals1 = append([]*types.Validator{v1}, vals1[1:len(vals1)]...) + vals2 = dummy.Validators() + valsEqual(t, vals1, vals2) + +} + +func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff []*types.Validator, txs ...[]byte) { + // make and apply block + height := uint64(heightInt) + hash := []byte("foo") + header := &types.Header{ + Height: height, + } + + dummyChain := dummy.(types.BlockchainAware) // hmm... + dummyChain.BeginBlock(hash, header) + for _, tx := range txs { + if r := dummy.DeliverTx(tx); r.IsErr() { + t.Fatal(r) + } + } + resEndBlock := dummyChain.EndBlock(height) + dummy.Commit() + + valsEqual(t, diff, resEndBlock.Diffs) + +} + +// order doesn't matter +func valsEqual(t *testing.T, vals1, vals2 []*types.Validator) { + if len(vals1) != len(vals2) { + t.Fatalf("vals dont match in len. got %d, expected %d", len(vals2), len(vals1)) + } + sort.Sort(types.Validators(vals1)) + sort.Sort(types.Validators(vals2)) + for i, v1 := range vals1 { + v2 := vals2[i] + if !bytes.Equal(v1.PubKey, v2.PubKey) || + v1.Power != v2.Power { + t.Fatalf("vals dont match at index %d. got %X/%d , expected %X/%d", i, v2.PubKey, v2.Power, v1.PubKey, v1.Power) + } + } +} + +func makeSocketClientServer(app types.Application, name string) (tmspcli.Client, Service, error) { + // Start the listener + socket := Fmt("unix://%s.sock", name) + server, err := server.NewSocketServer(socket, app) + if err != nil { + return nil, nil, err + } + + // Connect to the socket + client, err := tmspcli.NewSocketClient(socket, false) + if err != nil { + server.Stop() + return nil, nil, err + } + client.Start() + + return client, server, err +} + +func makeGRPCClientServer(app types.Application, name string) (tmspcli.Client, Service, error) { + // Start the listener + socket := Fmt("unix://%s.sock", name) + + gapp := types.NewGRPCApplication(app) + server, err := server.NewGRPCServer(socket, gapp) + if err != nil { + return nil, nil, err + } + + client, err := tmspcli.NewGRPCClient(socket, true) + if err != nil { + server.Stop() + return nil, nil, err + } + return client, server, err +} + +func TestClientServer(t *testing.T) { + // set up socket app + dummy := NewDummyApplication() + client, server, err := makeSocketClientServer(dummy, "dummy-socket") + require.Nil(t, err) + defer server.Stop() + defer client.Stop() + + runClientTests(t, client) + + // set up grpc app + dummy = NewDummyApplication() + gclient, gserver, err := makeGRPCClientServer(dummy, "dummy-grpc") + require.Nil(t, err) + defer gserver.Stop() + defer gclient.Stop() + + runClientTests(t, gclient) +} + +func runClientTests(t *testing.T, client tmspcli.Client) { + // run some tests.... + key := "abc" + value := key + tx := []byte(key) + testClient(t, client, tx, key, value) + + value = "def" + tx = []byte(key + "=" + value) + testClient(t, client, tx, key, value) +} + +func testClient(t *testing.T, app tmspcli.Client, tx []byte, key, value string) { + ar := app.AppendTxSync(tx) + require.False(t, ar.IsErr(), ar) + // repeating tx doesn't raise error + ar = app.AppendTxSync(tx) + require.False(t, ar.IsErr(), ar) + + // make sure query is fine + r := app.QuerySync([]byte(key)) + require.False(t, r.IsErr(), r) + q := new(QueryResult) + err := wire.ReadJSONBytes(r.Data, q) + require.Nil(t, err) + require.Equal(t, value, q.Value) + + // make sure proof is fine + rp := app.ProofSync([]byte(key), 0) + require.False(t, rp.IsErr(), rp) + p, err := merkle.LoadProof(rp.Data) + require.Nil(t, err) + require.True(t, p.Valid()) + assert.Equal(t, []byte(key), p.Key()) + assert.Equal(t, []byte(value), p.Value()) +} diff --git a/example/dummy/persistent_dummy.go b/example/dummy/persistent_dummy.go index 547fc1eb..73366c7e 100644 --- a/example/dummy/persistent_dummy.go +++ b/example/dummy/persistent_dummy.go @@ -90,8 +90,8 @@ func (app *PersistentDummyApplication) Commit() types.Result { return types.NewResultOK(appHash, "") } -func (app *PersistentDummyApplication) Query(query []byte) types.Result { - return app.app.Query(query) +func (app *PersistentDummyApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery { + return app.app.Query(reqQuery) } // Save the validators in the merkle tree diff --git a/example/nil/nil_app.go b/example/nil/nil_app.go index cd57f0d9..95ac8d59 100644 --- a/example/nil/nil_app.go +++ b/example/nil/nil_app.go @@ -31,6 +31,6 @@ func (app *NilApplication) Commit() types.Result { return types.NewResultOK([]byte("nil"), "") } -func (app *NilApplication) Query(query []byte) types.Result { - return types.NewResultOK(nil, "") +func (app *NilApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) { + return resQuery } diff --git a/glide.lock b/glide.lock index 42776a3a..c67e08b3 100644 --- a/glide.lock +++ b/glide.lock @@ -19,6 +19,11 @@ imports: version: d228849504861217f796da67fae4f6e347643f15 - name: github.com/mattn/go-isatty version: 30a891c33c7cde7b02a981314b4228ec99380cca +- name: github.com/stretchr/testify + version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 + subpackages: + - assert + - require - name: github.com/syndtr/goleveldb version: 23851d93a2292dcc56e71a18ec9e0624d84a0f65 subpackages: @@ -48,7 +53,7 @@ imports: - name: github.com/tendermint/go-logger version: cefb3a45c0bf3c493a04e9bcd9b1540528be59f2 - name: github.com/tendermint/go-merkle - version: 7a86b4486f2cd84ac885c5bbc609fdee2905f5d1 + version: 653cb1f631528351ddbc359b994eb0c96f0341cd - name: github.com/tendermint/go-process version: b27edfd189b1a01a0b099f7e9f8263589cf04909 - name: github.com/tendermint/go-wire @@ -102,4 +107,12 @@ imports: - stats - tap - transport -testImports: [] +testImports: +- name: github.com/davecgh/go-spew + version: 6d212800a42e8ab5c146b8ace3490ee17e5225f9 + subpackages: + - spew +- name: github.com/pmezard/go-difflib + version: d8ed2627bdf02c080bf22230dbb337003b7aba2d + subpackages: + - difflib diff --git a/glide.yaml b/glide.yaml index 295b3d3e..af174387 100644 --- a/glide.yaml +++ b/glide.yaml @@ -15,3 +15,7 @@ import: subpackages: - context - package: google.golang.org/grpc +- package: github.com/stretchr/testify + version: ^1.1.4 + subpackages: + - require diff --git a/server/socket_server.go b/server/socket_server.go index 76185505..46114027 100644 --- a/server/socket_server.go +++ b/server/socket_server.go @@ -184,8 +184,8 @@ func (s *SocketServer) handleRequest(req *types.Request, responses chan<- *types res := s.app.Commit() responses <- types.ToResponseCommit(res.Code, res.Data, res.Log) case *types.Request_Query: - res := s.app.Query(r.Query.Query) - responses <- types.ToResponseQuery(res.Code, res.Data, res.Log) + resQuery := s.app.Query(*r.Query) + responses <- types.ToResponseQuery(resQuery) case *types.Request_InitChain: if app, ok := s.app.(types.BlockchainAware); ok { app.InitChain(r.InitChain.Validators) diff --git a/tests/test_cli/ex1.abci.out b/tests/test_cli/ex1.abci.out index c8739758..e1e21d24 100644 --- a/tests/test_cli/ex1.abci.out +++ b/tests/test_cli/ex1.abci.out @@ -1,32 +1,38 @@ > echo hello -> data: hello +-> data.hex: 68656C6C6F > info -> data: {"size":0} +-> data.hex: 7B2273697A65223A307D > commit --> data: 0x > deliver_tx "abc" --> code: OK > info -> data: {"size":1} +-> data.hex: 7B2273697A65223A317D > commit --> data: 0x750502FC7E84BBD788ED589624F06CFA871845D1 +-> data: uü~„»×ˆíX–$ðlú‡EÑ +-> data.hex: 750502FC7E84BBD788ED589624F06CFA871845D1 > query "abc" --> code: OK --> data: {"index":0,"value":"abc","valueHex":"616263","exists":true} +-> value: abc +-> value.hex: 616263 +-> log: exists +-> height: 0 > deliver_tx "def=xyz" --> code: OK > commit --> data: 0x76393B8A182E450286B0694C629ECB51B286EFD5 +-> data: v9;Š.E†°iLbžËQ²†ïÕ +-> data.hex: 76393B8A182E450286B0694C629ECB51B286EFD5 > query "def" --> code: OK --> data: {"index":1,"value":"xyz","valueHex":"78797a","exists":true} +-> value: xyz +-> value.hex: 78797A +-> log: exists +-> height: 0 diff --git a/tests/test_cli/ex2.abci.out b/tests/test_cli/ex2.abci.out index 1fab1e84..202861cf 100644 --- a/tests/test_cli/ex2.abci.out +++ b/tests/test_cli/ex2.abci.out @@ -1,21 +1,16 @@ > set_option serial on --> data: serial=on > check_tx 0x00 --> code: OK > check_tx 0xff --> code: OK > deliver_tx 0x00 --> code: OK > check_tx 0x00 -> code: BadNonce -> log: Invalid nonce. Expected >= 1, got 0 > deliver_tx 0x01 --> code: OK > deliver_tx 0x04 -> code: BadNonce @@ -23,4 +18,5 @@ > info -> data: {"hashes":0,"txs":2} +-> data.hex: 7B22686173686573223A302C22747873223A327D diff --git a/types/application.go b/types/application.go index 4da5e6f7..404437fe 100644 --- a/types/application.go +++ b/types/application.go @@ -20,7 +20,7 @@ type Application interface { CheckTx(tx []byte) Result // Query for state - Query(query []byte) Result + Query(reqQuery RequestQuery) ResponseQuery // Return the application Merkle root hash Commit() Result @@ -78,8 +78,8 @@ func (app *GRPCApplication) CheckTx(ctx context.Context, req *RequestCheckTx) (* } func (app *GRPCApplication) Query(ctx context.Context, req *RequestQuery) (*ResponseQuery, error) { - r := app.app.Query(req.Query) - return &ResponseQuery{r.Code, r.Data, r.Log}, nil + resQuery := app.app.Query(*req) + return &resQuery, nil } func (app *GRPCApplication) Commit(ctx context.Context, req *RequestCommit) (*ResponseCommit, error) { diff --git a/types/code.go b/types/code.go new file mode 100644 index 00000000..c99a0bbe --- /dev/null +++ b/types/code.go @@ -0,0 +1,3 @@ +package types + +func (c CodeType) IsOK() bool { return c == CodeType_OK } diff --git a/types/messages.go b/types/messages.go index 84e6ee0b..fe2d310a 100644 --- a/types/messages.go +++ b/types/messages.go @@ -49,9 +49,9 @@ func ToRequestCommit() *Request { } } -func ToRequestQuery(queryBytes []byte) *Request { +func ToRequestQuery(reqQuery RequestQuery) *Request { return &Request{ - Value: &Request_Query{&RequestQuery{queryBytes}}, + Value: &Request_Query{&reqQuery}, } } @@ -123,9 +123,9 @@ func ToResponseCommit(code CodeType, data []byte, log string) *Response { } } -func ToResponseQuery(code CodeType, data []byte, log string) *Response { +func ToResponseQuery(resQuery ResponseQuery) *Response { return &Response{ - Value: &Response_Query{&ResponseQuery{code, data, log}}, + Value: &Response_Query{&resQuery}, } } diff --git a/types/types.pb.go b/types/types.pb.go index 6cae5433..e0ae1076 100644 --- a/types/types.pb.go +++ b/types/types.pb.go @@ -716,7 +716,10 @@ func (m *RequestCheckTx) GetTx() []byte { } type RequestQuery struct { - Query []byte `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` + Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` + Height uint64 `protobuf:"varint,3,opt,name=height" json:"height,omitempty"` + Prove bool `protobuf:"varint,4,opt,name=prove" json:"prove,omitempty"` } func (m *RequestQuery) Reset() { *m = RequestQuery{} } @@ -724,13 +727,34 @@ func (m *RequestQuery) String() string { return proto.CompactTextStri func (*RequestQuery) ProtoMessage() {} func (*RequestQuery) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } -func (m *RequestQuery) GetQuery() []byte { +func (m *RequestQuery) GetData() []byte { if m != nil { - return m.Query + return m.Data } return nil } +func (m *RequestQuery) GetPath() string { + if m != nil { + return m.Path + } + return "" +} + +func (m *RequestQuery) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *RequestQuery) GetProve() bool { + if m != nil { + return m.Prove + } + return false +} + type RequestCommit struct { } @@ -1387,9 +1411,13 @@ func (m *ResponseCheckTx) GetLog() string { } type ResponseQuery struct { - 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"` - Log string `protobuf:"bytes,3,opt,name=log" json:"log,omitempty"` + Code CodeType `protobuf:"varint,1,opt,name=code,enum=types.CodeType" json:"code,omitempty"` + Index int64 `protobuf:"varint,2,opt,name=index" json:"index,omitempty"` + Key []byte `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"` + Proof []byte `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` + Height uint64 `protobuf:"varint,6,opt,name=height" json:"height,omitempty"` + Log string `protobuf:"bytes,7,opt,name=log" json:"log,omitempty"` } func (m *ResponseQuery) Reset() { *m = ResponseQuery{} } @@ -1404,13 +1432,41 @@ func (m *ResponseQuery) GetCode() CodeType { return CodeType_OK } -func (m *ResponseQuery) GetData() []byte { +func (m *ResponseQuery) GetIndex() int64 { if m != nil { - return m.Data + return m.Index + } + return 0 +} + +func (m *ResponseQuery) GetKey() []byte { + if m != nil { + return m.Key } return nil } +func (m *ResponseQuery) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func (m *ResponseQuery) GetProof() []byte { + if m != nil { + return m.Proof + } + return nil +} + +func (m *ResponseQuery) GetHeight() uint64 { + if m != nil { + return m.Height + } + return 0 +} + func (m *ResponseQuery) GetLog() string { if m != nil { return m.Log @@ -2073,108 +2129,112 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{ func init() { proto.RegisterFile("types/types.proto", fileDescriptor0) } var fileDescriptor0 = []byte{ - // 1642 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x58, 0xc9, 0x6e, 0xdb, 0xdc, - 0x15, 0x36, 0x35, 0xeb, 0xc8, 0x96, 0xae, 0x8f, 0x65, 0x5b, 0x56, 0xbb, 0x08, 0xd8, 0xa6, 0xb1, - 0xdd, 0x34, 0x29, 0x1c, 0xa4, 0x88, 0x9b, 0xa2, 0x80, 0xa7, 0xd8, 0x42, 0x90, 0xc4, 0x65, 0x86, - 0x45, 0x5b, 0x54, 0xa0, 0xc5, 0x2b, 0x89, 0x35, 0x45, 0x32, 0x1c, 0x1c, 0xbb, 0xcf, 0x90, 0x7d, - 0x1f, 0xa1, 0x4f, 0xd0, 0xd5, 0xbf, 0xff, 0x81, 0x7f, 0x1e, 0x9e, 0xe8, 0xc7, 0x1d, 0x38, 0x9a, - 0xcc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df, 0x58, 0xf6, 0x2a, 0x1e, 0x96, 0x76, 0xb9, 0x2c, 0x3e, 0x69, 0x10, 0xca, 0xde, - 0xc6, 0xc3, 0xd2, 0x56, 0x17, 0x9f, 0xc4, 0x94, 0x81, 0xc5, 0x2f, 0xe4, 0x61, 0x49, 0xb7, 0xcb, - 0xb6, 0x47, 0x5c, 0xee, 0x45, 0x0f, 0xdf, 0x61, 0x61, 0x03, 0x8b, 0x8f, 0x23, 0x4e, 0xc2, 0xc2, - 0xc7, 0xf5, 0xb0, 0xb8, 0x4d, 0x66, 0x8b, 0x4c, 0x5e, 0x5f, 0x65, 0xaf, 0xe6, 0x61, 0x69, 0x03, - 0x8c, 0x07, 0x69, 0x92, 0xc3, 0xd2, 0xb7, 0xf3, 0xb0, 0xbc, 0x0d, 0xc6, 0xa7, 0x09, 0x2f, 0x62, - 0xc9, 0x0b, 0x7a, 0x58, 0xd6, 0x09, 0x5f, 0x34, 0xf8, 0x9f, 0x33, 0x8f, 0x7e, 0x09, 0x00, 0x00, - 0xff, 0xff, 0x84, 0x7d, 0xd1, 0x2f, 0xb1, 0x11, 0x00, 0x00, + // 1711 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0xac, 0x58, 0x4b, 0x6f, 0xe4, 0xc6, + 0x11, 0x16, 0xe7, 0x3d, 0x35, 0xd2, 0xa8, 0x55, 0x1a, 0x49, 0xd4, 0x24, 0x87, 0x05, 0x03, 0xc7, + 0xda, 0x8d, 0xb3, 0x1b, 0xc8, 0x70, 0xb0, 0x8a, 0x83, 0x00, 0xd2, 0xae, 0xbc, 0x1a, 0x18, 0xde, + 0x55, 0xe8, 0xb5, 0x2f, 0x09, 0x32, 0xa0, 0x86, 0x3d, 0x33, 0x8c, 0xa8, 0x26, 0x97, 0x6c, 0xca, + 0x52, 0x7e, 0x83, 0xef, 0xf9, 0x09, 0xb9, 0x07, 0xc8, 0x29, 0xf7,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43, 0x9d, 0x5a, 0xc7, 0x25, 0x20, + 0x3a, 0x29, 0x01, 0x51, 0xb7, 0x76, 0xfb, 0x0d, 0x48, 0x74, 0x52, 0x42, 0xa2, 0x5e, 0xad, 0x69, + 0x03, 0x14, 0x7d, 0x58, 0x80, 0xa2, 0x7e, 0xa5, 0x03, 0x95, 0x61, 0x0d, 0x16, 0x3d, 0xcb, 0xb0, + 0x68, 0x50, 0x41, 0x2f, 0x6d, 0x52, 0x05, 0xa3, 0x0f, 0x52, 0x30, 0x1a, 0xd6, 0x26, 0xad, 0x82, + 0x46, 0x27, 0x25, 0x34, 0x82, 0xda, 0x70, 0x1a, 0xe0, 0xe8, 0xe7, 0x65, 0x38, 0x52, 0x98, 0x72, + 0x58, 0xb1, 0x6d, 0xc4, 0xa3, 0x9f, 0x16, 0xf1, 0x68, 0xb3, 0x82, 0x82, 0xba, 0x16, 0xbe, 0x11, + 0x90, 0x1e, 0x8b, 0x4e, 0xa8, 0x54, 0x9a, 0xe8, 0x45, 0x1a, 0x45, 0x41, 0xa4, 0xb1, 0x44, 0x11, + 0xd6, 0x91, 0xe8, 0xf8, 0xbc, 0xbe, 0xbe, 0x01, 0xbc, 0x64, 0xd7, 0x16, 0xaa, 0xcb, 0xfa, 0xbd, + 0x91, 0xdb, 0x8a, 0x12, 0x2a, 0xa1, 0xc5, 0x50, 0xa3, 0x85, 0x09, 0xfd, 0x5b, 0x1a, 0xc5, 0xa2, + 0x96, 0x14, 0x60, 0xa4, 0x24, 0x3e, 0x81, 0x1d, 0xdf, 0x89, 0xb9, 0x0a, 0x73, 0x5e, 0x82, 0x8f, + 0x6d, 0x21, 0x50, 0xf1, 0x29, 0x1c, 0xf9, 0x31, 0xec, 0x16, 0x74, 0x9d, 0x30, 0x9c, 0xcb, 0xa6, + 0xee, 0xc8, 0xa6, 0x26, 0x99, 0xf6, 0x69, 0x18, 0x5e, 0x38, 0xf1, 0xda, 0x7a, 0x2f, 0x8f, 0xbf, + 0x84, 0xa4, 0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0x80, + 0x4d, 0x62, 0xe0, 0x10, 0xba, 0x12, 0x16, 0x49, 0x4b, 0x30, 0x05, 0x1e, 0x92, 0x36, 0x6e, 0xc1, + 0x30, 0x03, 0x20, 0xd2, 0x11, 0x64, 0x86, 0xc7, 0xa4, 0x2b, 0xc8, 0x0c, 0x77, 0xc8, 0x0e, 0x8e, + 0xa0, 0xaf, 0x61, 0x82, 0x20, 0x02, 0xf4, 0xd4, 0x49, 0x91, 0x5d, 0xe1, 0x5a, 0x36, 0x38, 0x99, + 0x08, 0x93, 0xac, 0xb4, 0xc9, 0x1e, 0x8e, 0x01, 0xf2, 0xa2, 0x26, 0xfb, 0xb8, 0x09, 0x83, 0xb4, + 0x9c, 0xc9, 0xc1, 0x93, 0x3f, 0x75, 0x61, 0x90, 0x36, 0x12, 0xf6, 0xa0, 0xf5, 0xe6, 0x53, 0xb2, + 0x81, 0x3b, 0xb0, 0x35, 0x63, 0x9c, 0x46, 0xcc, 0xf1, 0xcf, 0xc5, 0x0d, 0x40, 0x0c, 0xc1, 0x3a, + 0x67, 0x8b, 0xc0, 0xf5, 0xd8, 0x4a, 0xb1, 0x5a, 0xc2, 0xd1, 0x99, 0xe3, 0xbe, 0x0e, 0xd8, 0x82, + 0x92, 0x36, 0x12, 0xd8, 0xfc, 0x82, 0x39, 0x09, 0x5f, 0x07, 0x91, 0xf7, 0x3b, 0xea, 0x92, 0x0e, + 0xee, 0xc1, 0xce, 0x8c, 0xc5, 0xc9, 0x72, 0xe9, 0x2d, 0x3c, 0xca, 0xf8, 0x27, 0x09, 0x73, 0x63, + 0xd2, 0x45, 0x84, 0xf1, 0x17, 0xec, 0x9a, 0x05, 0x5f, 0x31, 0x3d, 0x39, 0x91, 0x1e, 0x9a, 0x30, + 0x39, 0x73, 0x62, 0xfa, 0x32, 0x09, 0x7d, 0x6f, 0xe1, 0x70, 0x7a, 0xea, 0xba, 0x11, 0x8d, 0x63, + 0x42, 0x85, 0x13, 0x21, 0x29, 0xaf, 0xbd,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git a/types/types.proto b/types/types.proto index b3ff1655..3eea82ea 100644 --- a/types/types.proto +++ b/types/types.proto @@ -6,67 +6,67 @@ package types; //---------------------------------------- // Message types -// Not being used +// Not being used // Could be added to request/response // so we don't have to type switch // (would be twice as fast, but we're talking about 15ns) enum MessageType { - NullMessage = 0x00; + NullMessage = 0x00; - Echo = 0x01; - Flush = 0x02; - Info = 0x03; - SetOption = 0x04; - Exception = 0x05; - DeliverTx = 0x11; - CheckTx = 0x12; - Commit = 0x13; - Query = 0x14; - InitChain = 0x15; - BeginBlock = 0x16; - EndBlock = 0x17; + Echo = 0x01; + Flush = 0x02; + Info = 0x03; + SetOption = 0x04; + Exception = 0x05; + DeliverTx = 0x11; + CheckTx = 0x12; + Commit = 0x13; + Query = 0x14; + InitChain = 0x15; + BeginBlock = 0x16; + EndBlock = 0x17; } //---------------------------------------- // Code types enum CodeType { - OK = 0; + OK = 0; - // General response codes, 0 ~ 99 - InternalError = 1; - EncodingError = 2; - BadNonce = 3; - Unauthorized = 4; - InsufficientFunds = 5; - UnknownRequest = 6; + // General response codes, 0 ~ 99 + InternalError = 1; + EncodingError = 2; + BadNonce = 3; + Unauthorized = 4; + InsufficientFunds = 5; + UnknownRequest = 6; - // Reserved for basecoin, 100 ~ 199 - BaseDuplicateAddress = 101; - BaseEncodingError = 102; - BaseInsufficientFees = 103; - BaseInsufficientFunds = 104; - BaseInsufficientGasPrice = 105; - BaseInvalidInput = 106; - BaseInvalidOutput = 107; - BaseInvalidPubKey = 108; - BaseInvalidSequence = 109; - BaseInvalidSignature = 110; - BaseUnknownAddress = 111; - BaseUnknownPubKey = 112; - BaseUnknownPlugin = 113; + // Reserved for basecoin, 100 ~ 199 + BaseDuplicateAddress = 101; + BaseEncodingError = 102; + BaseInsufficientFees = 103; + BaseInsufficientFunds = 104; + BaseInsufficientGasPrice = 105; + BaseInvalidInput = 106; + BaseInvalidOutput = 107; + BaseInvalidPubKey = 108; + BaseInvalidSequence = 109; + BaseInvalidSignature = 110; + BaseUnknownAddress = 111; + BaseUnknownPubKey = 112; + BaseUnknownPlugin = 113; - // Reserved for governance, 200 ~ 299 - GovUnknownEntity = 201; - GovUnknownGroup = 202; - GovUnknownProposal = 203; - GovDuplicateGroup = 204; - GovDuplicateMember = 205; - GovDuplicateProposal = 206; - GovDuplicateVote = 207; - GovInvalidMember = 208; - GovInvalidVote = 209; - GovInvalidVotingPower = 210; + // Reserved for governance, 200 ~ 299 + GovUnknownEntity = 201; + GovUnknownGroup = 202; + GovUnknownProposal = 203; + GovDuplicateGroup = 204; + GovDuplicateMember = 205; + GovDuplicateProposal = 206; + GovDuplicateVote = 207; + GovInvalidMember = 208; + GovInvalidVote = 209; + GovInvalidVotingPower = 210; } @@ -105,15 +105,18 @@ message RequestSetOption{ } message RequestDeliverTx{ - bytes tx = 1; + bytes tx = 1; } message RequestCheckTx{ - bytes tx = 1; + bytes tx = 1; } message RequestQuery{ - bytes query = 1; + bytes data = 1; + string path = 2; + uint64 height = 3; + bool prove = 4; } message RequestCommit{ @@ -189,8 +192,12 @@ message ResponseCheckTx{ message ResponseQuery{ CodeType code = 1; - bytes data = 2; - string log = 3; + int64 index = 2; + bytes key = 3; + bytes value = 4; + bytes proof = 5; + uint64 height = 6; + string log = 7; } message ResponseCommit{ @@ -222,7 +229,7 @@ message Header { bytes last_commit_hash = 6; bytes data_hash = 7; bytes validators_hash = 8; - bytes app_hash = 9; + bytes app_hash = 9; } message BlockID { @@ -236,8 +243,8 @@ message PartSetHeader { } message Validator { - bytes pubKey = 1; - uint64 power = 2; + bytes pubKey = 1; + uint64 power = 2; } //----------------------------------------