Browse Source

proto3 timestamp (#2064)

This PR changes ABCI time format from int64 (Unix seconds) to WKT (WellKnownType) google.protobuf.Timestamp.

Refs #1857

Reasons:

better precision
standard DT for proto

* update Gopkg.lock
* [makefile] remove extra grep
    - go list excludes vendor by default now
* proto3 timestamp
* [docs/abci-spec] note about serialisation format
* make time non-nullable
pull/2107/head
Anton Kaliaev 6 years ago
committed by Alexander Simmerl
parent
commit
96ae535fb8
24 changed files with 2786 additions and 1388 deletions
  1. +1
    -0
      CHANGELOG_PENDING.md
  2. +22
    -21
      Gopkg.lock
  3. +2
    -2
      Makefile
  4. +12
    -12
      abci/client/grpc_client.go
  5. +1
    -1
      abci/client/local_client.go
  6. +2
    -2
      abci/cmd/abci-cli/abci-cli.go
  7. +1
    -1
      abci/example/example_test.go
  8. +4
    -4
      abci/example/kvstore/kvstore_test.go
  9. +1
    -1
      abci/tests/test_app/app.go
  10. +1
    -1
      abci/types/application.go
  11. +5
    -5
      abci/types/messages.go
  12. +2054
    -624
      abci/types/types.pb.go
  13. +4
    -3
      abci/types/types.proto
  14. +650
    -690
      abci/types/typespb_test.go
  15. +2
    -2
      consensus/replay.go
  16. +1
    -1
      consensus/replay_test.go
  17. +9
    -4
      docs/app-dev/abci-spec.md
  18. +1
    -1
      mempool/mempool_test.go
  19. +1
    -1
      proxy/app_conn_test.go
  20. +2
    -2
      rpc/client/mock/abci.go
  21. +1
    -1
      rpc/core/abci.go
  22. +1
    -1
      state/execution.go
  23. +6
    -6
      state/execution_test.go
  24. +2
    -2
      types/protobuf.go

+ 1
- 0
CHANGELOG_PENDING.md View File

@ -6,6 +6,7 @@ BREAKING CHANGES:
- [abci] Removed Fee from ResponseDeliverTx and ResponseCheckTx - [abci] Removed Fee from ResponseDeliverTx and ResponseCheckTx
- [tools] Removed `make ensure_deps` in favor of `make get_vendor_deps` - [tools] Removed `make ensure_deps` in favor of `make get_vendor_deps`
- [p2p] Remove salsa and ripemd primitives, in favor of using chacha as a stream cipher, and hkdf - [p2p] Remove salsa and ripemd primitives, in favor of using chacha as a stream cipher, and hkdf
- [abci] Changed time format from int64 to google.protobuf.Timestamp
FEATURES: FEATURES:
- [tools] Added `make check_dep` - [tools] Added `make check_dep`


+ 22
- 21
Gopkg.lock View File

@ -11,14 +11,14 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:6aabc1566d6351115d561d038da82a4c19b46c3b6e17f4a0a2fa60260663dc79"
digest = "1:2c00f064ba355903866cbfbf3f7f4c0fe64af6638cc7d1b8bdcf3181bc67f1d8"
name = "github.com/btcsuite/btcd" name = "github.com/btcsuite/btcd"
packages = ["btcec"] packages = ["btcec"]
pruneopts = "UT" pruneopts = "UT"
revision = "9a2f9524024889e129a5422aca2cff73cb3eabf6" revision = "9a2f9524024889e129a5422aca2cff73cb3eabf6"
[[projects]] [[projects]]
digest = "1:df684ed7fed3fb406ec421424aaf5fc9c63ccc2f428b25b842da78e634482e4b"
digest = "1:1d8e1cb71c33a9470bbbae09bfec09db43c6bf358dfcae13cd8807c4e2a9a2bf"
name = "github.com/btcsuite/btcutil" name = "github.com/btcsuite/btcutil"
packages = [ packages = [
"base58", "base58",
@ -59,7 +59,7 @@
version = "v1.4.7" version = "v1.4.7"
[[projects]] [[projects]]
digest = "1:fa30c0652956e159cdb97dcb2ef8b8db63ed668c02a5c3a40961c8f0641252fe"
digest = "1:fdf5169073fb0ad6dc12a70c249145e30f4058647bea25f0abd48b6d9f228a11"
name = "github.com/go-kit/kit" name = "github.com/go-kit/kit"
packages = [ packages = [
"log", "log",
@ -91,7 +91,7 @@
version = "v1.7.0" version = "v1.7.0"
[[projects]] [[projects]]
digest = "1:212285efb97b9ec2e20550d81f0446cb7897e57cbdfd7301b1363ab113d8be45"
digest = "1:35621fe20f140f05a0c4ef662c26c0ab4ee50bca78aa30fe87d33120bd28165e"
name = "github.com/gogo/protobuf" name = "github.com/gogo/protobuf"
packages = [ packages = [
"gogoproto", "gogoproto",
@ -106,7 +106,7 @@
version = "v1.1.1" version = "v1.1.1"
[[projects]] [[projects]]
digest = "1:cb22af0ed7c72d495d8be1106233ee553898950f15fd3f5404406d44c2e86888"
digest = "1:17fe264ee908afc795734e8c4e63db2accabaf57326dbf21763a7d6b86096260"
name = "github.com/golang/protobuf" name = "github.com/golang/protobuf"
packages = [ packages = [
"proto", "proto",
@ -137,13 +137,12 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:8951fe6e358876736d8fa1f3992624fdbb2dec6bc49401c1381d1ef8abbb544f"
digest = "1:12247a2e99a060cc692f6680e5272c8adf0b8f572e6bce0d7095e624c958a240"
name = "github.com/hashicorp/hcl" name = "github.com/hashicorp/hcl"
packages = [ packages = [
".", ".",
"hcl/ast", "hcl/ast",
"hcl/parser", "hcl/parser",
"hcl/printer",
"hcl/scanner", "hcl/scanner",
"hcl/strconv", "hcl/strconv",
"hcl/token", "hcl/token",
@ -226,7 +225,7 @@
version = "v1.0.0" version = "v1.0.0"
[[projects]] [[projects]]
digest = "1:98225904b7abff96c052b669b25788f18225a36673fba022fb93514bb9a2a64e"
digest = "1:c1a04665f9613e082e1209cf288bf64f4068dcd6c87a64bf1c4ff006ad422ba0"
name = "github.com/prometheus/client_golang" name = "github.com/prometheus/client_golang"
packages = [ packages = [
"prometheus", "prometheus",
@ -237,7 +236,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:0f37e09b3e92aaeda5991581311f8dbf38944b36a3edec61cc2d1991f527554a"
digest = "1:2d5cd61daa5565187e1d96bae64dbbc6080dacf741448e9629c64fd93203b0d4"
name = "github.com/prometheus/client_model" name = "github.com/prometheus/client_model"
packages = ["go"] packages = ["go"]
pruneopts = "UT" pruneopts = "UT"
@ -245,7 +244,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:4d291d51042ed9de40eef61a3c1b56e969d6e0f8aa5fd3da5e958ec66bee68e4"
digest = "1:e469cd65badf7694aeb44874518606d93c1d59e7735d3754ad442782437d3cc3"
name = "github.com/prometheus/common" name = "github.com/prometheus/common"
packages = [ packages = [
"expfmt", "expfmt",
@ -257,7 +256,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:a37c98f4b7a66bb5c539c0539f0915a74ef1c8e0b3b6f45735289d94cae92bfd"
digest = "1:8c49953a1414305f2ff5465147ee576dd705487c35b15918fcd4efdc0cb7a290"
name = "github.com/prometheus/procfs" name = "github.com/prometheus/procfs"
packages = [ packages = [
".", ".",
@ -276,7 +275,7 @@
revision = "e2704e165165ec55d062f5919b4b29494e9fa790" revision = "e2704e165165ec55d062f5919b4b29494e9fa790"
[[projects]] [[projects]]
digest = "1:37ace7f35375adec11634126944bdc45a673415e2fcc07382d03b75ec76ea94c"
digest = "1:bd1ae00087d17c5a748660b8e89e1043e1e5479d0fea743352cda2f8dd8c4f84"
name = "github.com/spf13/afero" name = "github.com/spf13/afero"
packages = [ packages = [
".", ".",
@ -295,7 +294,7 @@
version = "v1.2.0" version = "v1.2.0"
[[projects]] [[projects]]
digest = "1:627ab2f549a6a55c44f46fa24a4307f4d0da81bfc7934ed0473bf38b24051d26"
digest = "1:7ffc0983035bc7e297da3688d9fe19d60a420e9c38bef23f845c53788ed6a05e"
name = "github.com/spf13/cobra" name = "github.com/spf13/cobra"
packages = ["."] packages = ["."]
pruneopts = "UT" pruneopts = "UT"
@ -327,7 +326,7 @@
version = "v1.0.0" version = "v1.0.0"
[[projects]] [[projects]]
digest = "1:73697231b93fb74a73ebd8384b68b9a60c57ea6b13c56d2425414566a72c8e6d"
digest = "1:7e8d267900c7fa7f35129a2a37596e38ed0f11ca746d6d9ba727980ee138f9f6"
name = "github.com/stretchr/testify" name = "github.com/stretchr/testify"
packages = [ packages = [
"assert", "assert",
@ -339,7 +338,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:922191411ad8f61bcd8018ac127589bb489712c1d1a0ab2497aca4b16de417d2"
digest = "1:b3cfb8d82b1601a846417c3f31c03a7961862cb2c98dcf0959c473843e6d9a2b"
name = "github.com/syndtr/goleveldb" name = "github.com/syndtr/goleveldb"
packages = [ packages = [
"leveldb", "leveldb",
@ -360,7 +359,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:203b409c21115233a576f99e8f13d8e07ad82b25500491f7e1cca12588fb3232"
digest = "1:087aaa7920e5d0bf79586feb57ce01c35c830396ab4392798112e8aae8c47722"
name = "github.com/tendermint/ed25519" name = "github.com/tendermint/ed25519"
packages = [ packages = [
".", ".",
@ -380,7 +379,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:df132ec33d5acb4a1ab58d637f1bc3557be49456ca59b9198f5c1e7fa32e0d31"
digest = "1:c31a37cafc12315b8bd745c8ad6a006ac25350472488162a821e557b3e739d67"
name = "golang.org/x/crypto" name = "golang.org/x/crypto"
packages = [ packages = [
"bcrypt", "bcrypt",
@ -402,7 +401,7 @@
revision = "c126467f60eb25f8f27e5a981f32a87e3965053f" revision = "c126467f60eb25f8f27e5a981f32a87e3965053f"
[[projects]] [[projects]]
digest = "1:04dda8391c3e2397daf254ac68003f30141c069b228d06baec8324a5f81dc1e9"
digest = "1:d36f55a999540d29b6ea3c2ea29d71c76b1d9853fdcd3e5c5cb4836f2ba118f1"
name = "golang.org/x/net" name = "golang.org/x/net"
packages = [ packages = [
"context", "context",
@ -419,7 +418,7 @@
[[projects]] [[projects]]
branch = "master" branch = "master"
digest = "1:bff8bf6fa46b4d638d61b48320e3c6da8f8ba190672a82cdb8cedafb1f9501b0"
digest = "1:12ff7b51d336ea7e8b182aa3313679a37d53de64f84d2c3cbfd6a0237877e20a"
name = "golang.org/x/sys" name = "golang.org/x/sys"
packages = [ packages = [
"cpu", "cpu",
@ -429,7 +428,7 @@
revision = "e072cadbbdc8dd3d3ffa82b8b4b9304c261d9311" revision = "e072cadbbdc8dd3d3ffa82b8b4b9304c261d9311"
[[projects]] [[projects]]
digest = "1:7509ba4347d1f8de6ae9be8818b0cd1abc3deeffe28aeaf4be6d4b6b5178d9ca"
digest = "1:a2ab62866c75542dd18d2b069fec854577a20211d7c0ea6ae746072a1dccdd18"
name = "golang.org/x/text" name = "golang.org/x/text"
packages = [ packages = [
"collate", "collate",
@ -459,7 +458,7 @@
revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200" revision = "7fd901a49ba6a7f87732eb344f6e3c5b19d1b200"
[[projects]] [[projects]]
digest = "1:4515e3030c440845b046354fd5d57671238428b820deebce2e9dabb5cd3c51ac"
digest = "1:2dab32a43451e320e49608ff4542fdfc653c95dcc35d0065ec9c6c3dd540ed74"
name = "google.golang.org/grpc" name = "google.golang.org/grpc"
packages = [ packages = [
".", ".",
@ -519,7 +518,9 @@
"github.com/gogo/protobuf/gogoproto", "github.com/gogo/protobuf/gogoproto",
"github.com/gogo/protobuf/jsonpb", "github.com/gogo/protobuf/jsonpb",
"github.com/gogo/protobuf/proto", "github.com/gogo/protobuf/proto",
"github.com/gogo/protobuf/types",
"github.com/golang/protobuf/proto", "github.com/golang/protobuf/proto",
"github.com/golang/protobuf/ptypes/timestamp",
"github.com/gorilla/websocket", "github.com/gorilla/websocket",
"github.com/jmhodges/levigo", "github.com/jmhodges/levigo",
"github.com/pkg/errors", "github.com/pkg/errors",


+ 2
- 2
Makefile View File

@ -5,7 +5,7 @@ GOTOOLS = \
github.com/gogo/protobuf/protoc-gen-gogo \ github.com/gogo/protobuf/protoc-gen-gogo \
github.com/gogo/protobuf/gogoproto \ github.com/gogo/protobuf/gogoproto \
github.com/square/certstrap github.com/square/certstrap
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
PACKAGES=$(shell go list ./...)
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
BUILD_TAGS?='tendermint' BUILD_TAGS?='tendermint'
@ -37,7 +37,7 @@ protoc_all: protoc_libs protoc_abci protoc_grpc
## If you get the following error, ## If you get the following error,
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory" ## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## See https://stackoverflow.com/a/25518702 ## See https://stackoverflow.com/a/25518702
protoc $(INCLUDE) $< --gogo_out=plugins=grpc:.
protoc $(INCLUDE) $< --gogo_out=Mgoogle/protobuf/timestamp.proto=github.com/golang/protobuf/ptypes/timestamp,plugins=grpc:.
@echo "--> adding nolint declarations to protobuf generated files" @echo "--> adding nolint declarations to protobuf generated files"
@awk -i inplace '/^\s*package \w+/ { print "//nolint" }1' $@ @awk -i inplace '/^\s*package \w+/ { print "//nolint" }1' $@


+ 12
- 12
abci/client/grpc_client.go View File

@ -63,7 +63,7 @@ RETRY_LOOP:
ENSURE_CONNECTED: ENSURE_CONNECTED:
for { for {
_, err := client.Echo(context.Background(), &types.RequestEcho{"hello"}, grpc.FailFast(true))
_, err := client.Echo(context.Background(), &types.RequestEcho{Message: "hello"}, grpc.FailFast(true))
if err == nil { if err == nil {
break ENSURE_CONNECTED break ENSURE_CONNECTED
} }
@ -129,7 +129,7 @@ func (cli *grpcClient) EchoAsync(msg string) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_Echo{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Echo{res}})
} }
func (cli *grpcClient) FlushAsync() *ReqRes { func (cli *grpcClient) FlushAsync() *ReqRes {
@ -138,7 +138,7 @@ func (cli *grpcClient) FlushAsync() *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_Flush{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Flush{res}})
} }
func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes { func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes {
@ -147,7 +147,7 @@ func (cli *grpcClient) InfoAsync(params types.RequestInfo) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_Info{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Info{res}})
} }
func (cli *grpcClient) SetOptionAsync(params types.RequestSetOption) *ReqRes { func (cli *grpcClient) SetOptionAsync(params types.RequestSetOption) *ReqRes {
@ -156,7 +156,7 @@ func (cli *grpcClient) SetOptionAsync(params types.RequestSetOption) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_SetOption{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_SetOption{res}})
} }
func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes { func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes {
@ -165,7 +165,7 @@ func (cli *grpcClient) DeliverTxAsync(tx []byte) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_DeliverTx{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_DeliverTx{res}})
} }
func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes { func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
@ -174,7 +174,7 @@ func (cli *grpcClient) CheckTxAsync(tx []byte) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_CheckTx{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_CheckTx{res}})
} }
func (cli *grpcClient) QueryAsync(params types.RequestQuery) *ReqRes { func (cli *grpcClient) QueryAsync(params types.RequestQuery) *ReqRes {
@ -183,7 +183,7 @@ func (cli *grpcClient) QueryAsync(params types.RequestQuery) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_Query{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Query{res}})
} }
func (cli *grpcClient) CommitAsync() *ReqRes { func (cli *grpcClient) CommitAsync() *ReqRes {
@ -192,7 +192,7 @@ func (cli *grpcClient) CommitAsync() *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_Commit{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_Commit{res}})
} }
func (cli *grpcClient) InitChainAsync(params types.RequestInitChain) *ReqRes { func (cli *grpcClient) InitChainAsync(params types.RequestInitChain) *ReqRes {
@ -201,7 +201,7 @@ func (cli *grpcClient) InitChainAsync(params types.RequestInitChain) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_InitChain{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_InitChain{res}})
} }
func (cli *grpcClient) BeginBlockAsync(params types.RequestBeginBlock) *ReqRes { func (cli *grpcClient) BeginBlockAsync(params types.RequestBeginBlock) *ReqRes {
@ -210,7 +210,7 @@ func (cli *grpcClient) BeginBlockAsync(params types.RequestBeginBlock) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_BeginBlock{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_BeginBlock{res}})
} }
func (cli *grpcClient) EndBlockAsync(params types.RequestEndBlock) *ReqRes { func (cli *grpcClient) EndBlockAsync(params types.RequestEndBlock) *ReqRes {
@ -219,7 +219,7 @@ func (cli *grpcClient) EndBlockAsync(params types.RequestEndBlock) *ReqRes {
if err != nil { if err != nil {
cli.StopForError(err) cli.StopForError(err)
} }
return cli.finishAsyncCall(req, &types.Response{&types.Response_EndBlock{res}})
return cli.finishAsyncCall(req, &types.Response{Value: &types.Response_EndBlock{res}})
} }
func (cli *grpcClient) finishAsyncCall(req *types.Request, res *types.Response) *ReqRes { func (cli *grpcClient) finishAsyncCall(req *types.Request, res *types.Response) *ReqRes {


+ 1
- 1
abci/client/local_client.go View File

@ -149,7 +149,7 @@ func (app *localClient) FlushSync() error {
} }
func (app *localClient) EchoSync(msg string) (*types.ResponseEcho, error) { func (app *localClient) EchoSync(msg string) (*types.ResponseEcho, error) {
return &types.ResponseEcho{msg}, nil
return &types.ResponseEcho{Message: msg}, nil
} }
func (app *localClient) InfoSync(req types.RequestInfo) (*types.ResponseInfo, error) { func (app *localClient) InfoSync(req types.RequestInfo) (*types.ResponseInfo, error) {


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

@ -514,7 +514,7 @@ func cmdInfo(cmd *cobra.Command, args []string) error {
if len(args) == 1 { if len(args) == 1 {
version = args[0] version = args[0]
} }
res, err := client.InfoSync(types.RequestInfo{version})
res, err := client.InfoSync(types.RequestInfo{Version: version})
if err != nil { if err != nil {
return err return err
} }
@ -537,7 +537,7 @@ func cmdSetOption(cmd *cobra.Command, args []string) error {
} }
key, val := args[0], args[1] key, val := args[0], args[1]
_, err := client.SetOptionSync(types.RequestSetOption{key, val})
_, err := client.SetOptionSync(types.RequestSetOption{Key: key, Value: val})
if err != nil { if err != nil {
return err return err
} }


+ 1
- 1
abci/example/example_test.go View File

@ -132,7 +132,7 @@ func testGRPCSync(t *testing.T, app *types.GRPCApplication) {
// Write requests // Write requests
for counter := 0; counter < numDeliverTxs; counter++ { for counter := 0; counter < numDeliverTxs; counter++ {
// Send request // Send request
response, err := client.DeliverTx(context.Background(), &types.RequestDeliverTx{[]byte("test")})
response, err := client.DeliverTx(context.Background(), &types.RequestDeliverTx{Tx: []byte("test")})
if err != nil { if err != nil {
t.Fatalf("Error in GRPC DeliverTx: %v", err.Error()) t.Fatalf("Error in GRPC DeliverTx: %v", err.Error())
} }


+ 4
- 4
abci/example/kvstore/kvstore_test.go View File

@ -90,8 +90,8 @@ func TestPersistentKVStoreInfo(t *testing.T) {
header := types.Header{ header := types.Header{
Height: int64(height), Height: int64(height),
} }
kvstore.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
kvstore.EndBlock(types.RequestEndBlock{header.Height})
kvstore.BeginBlock(types.RequestBeginBlock{Hash: hash, Header: header})
kvstore.EndBlock(types.RequestEndBlock{Height: header.Height})
kvstore.Commit() kvstore.Commit()
resInfo = kvstore.Info(types.RequestInfo{}) resInfo = kvstore.Info(types.RequestInfo{})
@ -176,13 +176,13 @@ func makeApplyBlock(t *testing.T, kvstore types.Application, heightInt int, diff
Height: height, Height: height,
} }
kvstore.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
kvstore.BeginBlock(types.RequestBeginBlock{Hash: hash, Header: header})
for _, tx := range txs { for _, tx := range txs {
if r := kvstore.DeliverTx(tx); r.IsErr() { if r := kvstore.DeliverTx(tx); r.IsErr() {
t.Fatal(r) t.Fatal(r)
} }
} }
resEndBlock := kvstore.EndBlock(types.RequestEndBlock{header.Height})
resEndBlock := kvstore.EndBlock(types.RequestEndBlock{Height: header.Height})
kvstore.Commit() kvstore.Commit()
valsEqual(t, diff, resEndBlock.ValidatorUpdates) valsEqual(t, diff, resEndBlock.ValidatorUpdates)


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

@ -26,7 +26,7 @@ func startClient(abciType string) abcicli.Client {
} }
func setOption(client abcicli.Client, key, value string) { func setOption(client abcicli.Client, key, value string) {
_, err := client.SetOptionSync(types.RequestSetOption{key, value})
_, err := client.SetOptionSync(types.RequestSetOption{Key: key, Value: value})
if err != nil { if err != nil {
panicf("setting %v=%v: \nerr: %v", key, value, err) panicf("setting %v=%v: \nerr: %v", key, value, err)
} }


+ 1
- 1
abci/types/application.go View File

@ -85,7 +85,7 @@ func NewGRPCApplication(app Application) *GRPCApplication {
} }
func (app *GRPCApplication) Echo(ctx context.Context, req *RequestEcho) (*ResponseEcho, error) { func (app *GRPCApplication) Echo(ctx context.Context, req *RequestEcho) (*ResponseEcho, error) {
return &ResponseEcho{req.Message}, nil
return &ResponseEcho{Message: req.Message}, nil
} }
func (app *GRPCApplication) Flush(ctx context.Context, req *RequestFlush) (*ResponseFlush, error) { func (app *GRPCApplication) Flush(ctx context.Context, req *RequestFlush) (*ResponseFlush, error) {


+ 5
- 5
abci/types/messages.go View File

@ -71,7 +71,7 @@ func encodeVarint(w io.Writer, i int64) (err error) {
func ToRequestEcho(message string) *Request { func ToRequestEcho(message string) *Request {
return &Request{ return &Request{
Value: &Request_Echo{&RequestEcho{message}},
Value: &Request_Echo{&RequestEcho{Message: message}},
} }
} }
@ -95,13 +95,13 @@ func ToRequestSetOption(req RequestSetOption) *Request {
func ToRequestDeliverTx(tx []byte) *Request { func ToRequestDeliverTx(tx []byte) *Request {
return &Request{ return &Request{
Value: &Request_DeliverTx{&RequestDeliverTx{tx}},
Value: &Request_DeliverTx{&RequestDeliverTx{Tx: tx}},
} }
} }
func ToRequestCheckTx(tx []byte) *Request { func ToRequestCheckTx(tx []byte) *Request {
return &Request{ return &Request{
Value: &Request_CheckTx{&RequestCheckTx{tx}},
Value: &Request_CheckTx{&RequestCheckTx{Tx: tx}},
} }
} }
@ -139,13 +139,13 @@ func ToRequestEndBlock(req RequestEndBlock) *Request {
func ToResponseException(errStr string) *Response { func ToResponseException(errStr string) *Response {
return &Response{ return &Response{
Value: &Response_Exception{&ResponseException{errStr}},
Value: &Response_Exception{&ResponseException{Error: errStr}},
} }
} }
func ToResponseEcho(message string) *Response { func ToResponseEcho(message string) *Response {
return &Response{ return &Response{
Value: &Response_Echo{&ResponseEcho{message}},
Value: &Response_Echo{&ResponseEcho{Message: message}},
} }
} }


+ 2054
- 624
abci/types/types.pb.go
File diff suppressed because it is too large
View File


+ 4
- 3
abci/types/types.proto View File

@ -4,6 +4,7 @@ package types;
// For more information on gogo.proto, see: // For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md // https://github.com/gogo/protobuf/blob/master/extensions.md
import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/timestamp.proto";
import "github.com/tendermint/tendermint/libs/common/types.proto"; import "github.com/tendermint/tendermint/libs/common/types.proto";
// This file is copied from http://github.com/tendermint/abci // This file is copied from http://github.com/tendermint/abci
@ -56,7 +57,7 @@ message RequestSetOption {
} }
message RequestInitChain { message RequestInitChain {
int64 time = 1;
google.protobuf.Timestamp time = 1 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
string chain_id = 2; string chain_id = 2;
ConsensusParams consensus_params = 3; ConsensusParams consensus_params = 3;
repeated Validator validators = 4 [(gogoproto.nullable)=false]; repeated Validator validators = 4 [(gogoproto.nullable)=false];
@ -230,7 +231,7 @@ message Header {
// basics // basics
string chain_id = 1 [(gogoproto.customname)="ChainID"]; string chain_id = 1 [(gogoproto.customname)="ChainID"];
int64 height = 2; int64 height = 2;
int64 time = 3;
google.protobuf.Timestamp time = 3 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
// txs // txs
int32 num_txs = 4; int32 num_txs = 4;
@ -267,7 +268,7 @@ message Evidence {
string type = 1; string type = 1;
Validator validator = 2 [(gogoproto.nullable)=false]; Validator validator = 2 [(gogoproto.nullable)=false];
int64 height = 3; int64 height = 3;
int64 time = 4;
google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true];
int64 total_voting_power = 5; int64 total_voting_power = 5;
} }


+ 650
- 690
abci/types/typespb_test.go
File diff suppressed because it is too large
View File


+ 2
- 2
consensus/replay.go View File

@ -227,7 +227,7 @@ func (h *Handshaker) NBlocks() int {
func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error { func (h *Handshaker) Handshake(proxyApp proxy.AppConns) error {
// Handshake is done via ABCI Info on the query conn. // Handshake is done via ABCI Info on the query conn.
res, err := proxyApp.Query().InfoSync(abci.RequestInfo{version.Version})
res, err := proxyApp.Query().InfoSync(abci.RequestInfo{Version: version.Version})
if err != nil { if err != nil {
return fmt.Errorf("Error calling Info: %v", err) return fmt.Errorf("Error calling Info: %v", err)
} }
@ -269,7 +269,7 @@ func (h *Handshaker) ReplayBlocks(state sm.State, appHash []byte, appBlockHeight
validators := types.TM2PB.Validators(state.Validators) validators := types.TM2PB.Validators(state.Validators)
csParams := types.TM2PB.ConsensusParams(h.genDoc.ConsensusParams) csParams := types.TM2PB.ConsensusParams(h.genDoc.ConsensusParams)
req := abci.RequestInitChain{ req := abci.RequestInitChain{
Time: h.genDoc.GenesisTime.Unix(), // TODO
Time: h.genDoc.GenesisTime,
ChainId: h.genDoc.ChainID, ChainId: h.genDoc.ChainID,
ConsensusParams: csParams, ConsensusParams: csParams,
Validators: validators, Validators: validators,


+ 1
- 1
consensus/replay_test.go View File

@ -376,7 +376,7 @@ func testHandshakeReplay(t *testing.T, nBlocks int, mode uint) {
defer proxyApp.Stop() defer proxyApp.Stop()
// get the latest app hash from the app // get the latest app hash from the app
res, err := proxyApp.Query().InfoSync(abci.RequestInfo{""})
res, err := proxyApp.Query().InfoSync(abci.RequestInfo{Version: ""})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }


+ 9
- 4
docs/app-dev/abci-spec.md View File

@ -108,8 +108,11 @@ See below for more details on the message types and how they are used.
### InitChain ### InitChain
- **Request**: - **Request**:
- `Validators ([]Validator)`: Initial genesis validators
- `AppStateBytes ([]byte)`: Serialized initial application state
- `Time (google.protobuf.Timestamp)`: Genesis time.
- `ChainID (string)`: ID of the blockchain.
- `ConsensusParams (ConsensusParams)`: Initial consensus-critical parameters.
- `Validators ([]Validator)`: Initial genesis validators.
- `AppStateBytes ([]byte)`: Serialized initial application state. Amino-encoded JSON bytes.
- **Response**: - **Response**:
- `ConsensusParams (ConsensusParams)`: Initial - `ConsensusParams (ConsensusParams)`: Initial
consensus-critical parameters. consensus-critical parameters.
@ -263,7 +266,8 @@ See below for more details on the message types and how they are used.
- **Fields**: - **Fields**:
- `ChainID (string)`: ID of the blockchain - `ChainID (string)`: ID of the blockchain
- `Height (int64)`: Height of the block in the chain - `Height (int64)`: Height of the block in the chain
- `Time (int64)`: Unix time of the block
- `Time (google.protobuf.Timestamp)`: Time of the block. It is the proposer's
local time when block was created.
- `NumTxs (int32)`: Number of transactions in the block - `NumTxs (int32)`: Number of transactions in the block
- `TotalTxs (int64)`: Total number of transactions in the blockchain until - `TotalTxs (int64)`: Total number of transactions in the blockchain until
now now
@ -318,6 +322,7 @@ See below for more details on the message types and how they are used.
"duplicate/vote". "duplicate/vote".
- `Validator (Validator`: The offending validator - `Validator (Validator`: The offending validator
- `Height (int64)`: Height when the offense was committed - `Height (int64)`: Height when the offense was committed
- `Time (int64)`: Unix time of the block at height `Height`
- `Time (google.protobuf.Timestamp)`: Time of the block at height `Height`.
It is the proposer's local time when block was created.
- `TotalVotingPower (int64)`: Total voting power of the validator set at - `TotalVotingPower (int64)`: Total voting power of the validator set at
height `Height` height `Height`

+ 1
- 1
mempool/mempool_test.go View File

@ -117,7 +117,7 @@ func TestTxsAvailable(t *testing.T) {
func TestSerialReap(t *testing.T) { func TestSerialReap(t *testing.T) {
app := counter.NewCounterApplication(true) app := counter.NewCounterApplication(true)
app.SetOption(abci.RequestSetOption{"serial", "on"})
app.SetOption(abci.RequestSetOption{Key: "serial", Value: "on"})
cc := proxy.NewLocalClientCreator(app) cc := proxy.NewLocalClientCreator(app)
mempool := newMempoolWithApp(cc) mempool := newMempoolWithApp(cc)


+ 1
- 1
proxy/app_conn_test.go View File

@ -142,7 +142,7 @@ func TestInfo(t *testing.T) {
proxy := NewAppConnTest(cli) proxy := NewAppConnTest(cli)
t.Log("Connected") t.Log("Connected")
resInfo, err := proxy.InfoSync(types.RequestInfo{""})
resInfo, err := proxy.InfoSync(types.RequestInfo{Version: ""})
if err != nil { if err != nil {
t.Errorf("Unexpected error: %v", err) t.Errorf("Unexpected error: %v", err)
} }


+ 2
- 2
rpc/client/mock/abci.go View File

@ -23,7 +23,7 @@ var (
) )
func (a ABCIApp) ABCIInfo() (*ctypes.ResultABCIInfo, error) { func (a ABCIApp) ABCIInfo() (*ctypes.ResultABCIInfo, error) {
return &ctypes.ResultABCIInfo{a.App.Info(abci.RequestInfo{version.Version})}, nil
return &ctypes.ResultABCIInfo{a.App.Info(abci.RequestInfo{Version: version.Version})}, nil
} }
func (a ABCIApp) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) { func (a ABCIApp) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQuery, error) {
@ -31,7 +31,7 @@ func (a ABCIApp) ABCIQuery(path string, data cmn.HexBytes) (*ctypes.ResultABCIQu
} }
func (a ABCIApp) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) { func (a ABCIApp) ABCIQueryWithOptions(path string, data cmn.HexBytes, opts client.ABCIQueryOptions) (*ctypes.ResultABCIQuery, error) {
q := a.App.Query(abci.RequestQuery{data, path, opts.Height, opts.Trusted})
q := a.App.Query(abci.RequestQuery{Data: data, Path: path, Height: opts.Height, Prove: opts.Trusted})
return &ctypes.ResultABCIQuery{q}, nil return &ctypes.ResultABCIQuery{q}, nil
} }


+ 1
- 1
rpc/core/abci.go View File

@ -93,7 +93,7 @@ func ABCIQuery(path string, data cmn.HexBytes, height int64, trusted bool) (*cty
// } // }
// ``` // ```
func ABCIInfo() (*ctypes.ResultABCIInfo, error) { func ABCIInfo() (*ctypes.ResultABCIInfo, error) {
resInfo, err := proxyAppQuery.InfoSync(abci.RequestInfo{version.Version})
resInfo, err := proxyAppQuery.InfoSync(abci.RequestInfo{Version: version.Version})
if err != nil { if err != nil {
return nil, err return nil, err
} }


+ 1
- 1
state/execution.go View File

@ -207,7 +207,7 @@ func execBlockOnProxyApp(logger log.Logger, proxyAppConn proxy.AppConnConsensus,
} }
// End block // End block
abciResponses.EndBlock, err = proxyAppConn.EndBlockSync(abci.RequestEndBlock{block.Height})
abciResponses.EndBlock, err = proxyAppConn.EndBlockSync(abci.RequestEndBlock{Height: block.Height})
if err != nil { if err != nil {
logger.Error("Error in proxyAppConn.EndBlock", "err", err) logger.Error("Error in proxyAppConn.EndBlock", "err", err)
return nil, err return nil, err


+ 6
- 6
state/execution_test.go View File

@ -168,7 +168,7 @@ func TestUpdateValidators(t *testing.T) {
"adding a validator is OK", "adding a validator is OK",
types.NewValidatorSet([]*types.Validator{val1}), types.NewValidatorSet([]*types.Validator{val1}),
[]abci.Validator{{[]byte{}, types.TM2PB.PubKey(pubkey2), 20}},
[]abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: 20}},
types.NewValidatorSet([]*types.Validator{val1, val2}), types.NewValidatorSet([]*types.Validator{val1, val2}),
false, false,
@ -177,7 +177,7 @@ func TestUpdateValidators(t *testing.T) {
"updating a validator is OK", "updating a validator is OK",
types.NewValidatorSet([]*types.Validator{val1}), types.NewValidatorSet([]*types.Validator{val1}),
[]abci.Validator{{[]byte{}, types.TM2PB.PubKey(pubkey1), 20}},
[]abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey1), Power: 20}},
types.NewValidatorSet([]*types.Validator{types.NewValidator(pubkey1, 20)}), types.NewValidatorSet([]*types.Validator{types.NewValidator(pubkey1, 20)}),
false, false,
@ -186,7 +186,7 @@ func TestUpdateValidators(t *testing.T) {
"removing a validator is OK", "removing a validator is OK",
types.NewValidatorSet([]*types.Validator{val1, val2}), types.NewValidatorSet([]*types.Validator{val1, val2}),
[]abci.Validator{{[]byte{}, types.TM2PB.PubKey(pubkey2), 0}},
[]abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}},
types.NewValidatorSet([]*types.Validator{val1}), types.NewValidatorSet([]*types.Validator{val1}),
false, false,
@ -196,7 +196,7 @@ func TestUpdateValidators(t *testing.T) {
"removing a non-existing validator results in error", "removing a non-existing validator results in error",
types.NewValidatorSet([]*types.Validator{val1}), types.NewValidatorSet([]*types.Validator{val1}),
[]abci.Validator{{[]byte{}, types.TM2PB.PubKey(pubkey2), 0}},
[]abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: 0}},
types.NewValidatorSet([]*types.Validator{val1}), types.NewValidatorSet([]*types.Validator{val1}),
true, true,
@ -206,7 +206,7 @@ func TestUpdateValidators(t *testing.T) {
"adding a validator with negative power results in error", "adding a validator with negative power results in error",
types.NewValidatorSet([]*types.Validator{val1}), types.NewValidatorSet([]*types.Validator{val1}),
[]abci.Validator{{[]byte{}, types.TM2PB.PubKey(pubkey2), -100}},
[]abci.Validator{{Address: []byte{}, PubKey: types.TM2PB.PubKey(pubkey2), Power: -100}},
types.NewValidatorSet([]*types.Validator{val1}), types.NewValidatorSet([]*types.Validator{val1}),
true, true,
@ -262,7 +262,7 @@ func state(nVals, height int) (State, dbm.DB) {
SaveState(stateDB, s) SaveState(stateDB, s)
for i := 1; i < height; i++ { for i := 1; i < height; i++ {
s.LastBlockHeight += 1
s.LastBlockHeight++
SaveState(stateDB, s) SaveState(stateDB, s)
} }
return s, stateDB return s, stateDB


+ 2
- 2
types/protobuf.go View File

@ -38,7 +38,7 @@ func (tm2pb) Header(header *Header) abci.Header {
ChainID: header.ChainID, ChainID: header.ChainID,
Height: header.Height, Height: header.Height,
Time: header.Time.Unix(),
Time: header.Time,
NumTxs: int32(header.NumTxs), // XXX: overflow NumTxs: int32(header.NumTxs), // XXX: overflow
TotalTxs: header.TotalTxs, TotalTxs: header.TotalTxs,
@ -131,7 +131,7 @@ func (tm2pb) Evidence(ev Evidence, valSet *ValidatorSet, evTime time.Time) abci.
Type: evType, Type: evType,
Validator: TM2PB.Validator(val), Validator: TM2PB.Validator(val),
Height: ev.Height(), Height: ev.Height(),
Time: evTime.Unix(),
Time: evTime,
TotalVotingPower: valSet.TotalVotingPower(), TotalVotingPower: valSet.TotalVotingPower(),
} }
} }


Loading…
Cancel
Save