Browse Source

Merge pull request #198 from tendermint/develop

v0.10.0
pull/1780/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
68592f4d8e
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 1123 additions and 926 deletions
  1. +2
    -0
      .gitignore
  2. +19
    -0
      CHANGELOG.md
  3. +105
    -55
      Makefile
  4. +98
    -141
      README.md
  5. +1
    -1
      circle.yml
  6. +1
    -1
      client/socket_client.go
  7. +73
    -50
      cmd/abci-cli/abci-cli.go
  8. +0
    -2
      example/code/code.go
  9. +11
    -9
      example/counter/counter.go
  10. +59
    -32
      example/dummy/dummy.go
  11. +12
    -19
      example/dummy/dummy_test.go
  12. +9
    -7
      example/dummy/helpers.go
  13. +22
    -39
      example/dummy/persistent_dummy.go
  14. +17
    -48
      glide.lock
  15. +5
    -10
      glide.yaml
  16. +13
    -13
      scripts/dist_build.sh
  17. +205
    -0
      specification.rst
  18. +12
    -13
      tests/server/client.go
  19. +3
    -1
      tests/test.sh
  20. +0
    -3
      tests/test_app/app.go
  21. +23
    -23
      tests/test_cli/test.sh
  22. +2
    -2
      types/application.go
  23. +48
    -11
      types/messages.go
  24. +55
    -5
      types/messages_test.go
  25. +1
    -36
      types/result.go
  26. +0
    -74
      types/result_test.go
  27. +276
    -245
      types/types.pb.go
  28. +44
    -41
      types/types.proto
  29. +5
    -28
      types/util.go
  30. +0
    -15
      types/util_test.go
  31. +2
    -2
      version/version.go

+ 2
- 0
.gitignore View File

@ -1,3 +1,5 @@
vendor
.glide
types/types.pb.go
*.sw[op]
abci-cli

+ 19
- 0
CHANGELOG.md View File

@ -1,5 +1,24 @@
# Changelog
## 0.10.0 (February 20, 2018)
BREAKING CHANGES:
- [types] Drop gogo custom type magic with data.Bytes
- [types] Add `info string` field to responses for SetOption, Query, CheckTx, DeliverTx
- [types] Remove IsOk/IsErr methods from response types.
- [types] Replace KVPair with common.KVPair
- [types] Updates to CheckTx/DeliverTx around tags and fees
- [types] Remove code and log from Commit
FEATURES:
- [types] RequestInitChain.AppStateBytes for app's genesis state
IMPROVEMENTS:
- [all] remove go-wire and go-crypto dependencies :)
## 0.9.0 (December 28, 2017)
BREAKING CHANGES:


+ 105
- 55
Makefile View File

@ -1,18 +1,56 @@
GOTOOLS = \
github.com/mitchellh/gox \
github.com/Masterminds/glide \
github.com/gogo/protobuf/protoc-gen-gogo \
github.com/gogo/protobuf/gogoproto
#gopkg.in/alecthomas/gometalinter.v2 \
github.com/mitchellh/gox \
github.com/Masterminds/glide \
gopkg.in/alecthomas/gometalinter.v2 \
github.com/gogo/protobuf/protoc-gen-gogo \
github.com/gogo/protobuf/gogoproto
GOTOOLS_CHECK = gox glide gometalinter.v2 protoc protoc-gen-gogo
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
INCLUDE = -I=. -I=${GOPATH}/src -I=${GOPATH}/src/github.com/gogo/protobuf/protobuf
all: protoc install test
all: check get_vendor_deps protoc build test install metalinter
PACKAGES=$(shell go list ./... | grep -v '/vendor/')
check: check_tools
########################################
### Build
protoc:
## If you get the following error,
## "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## See https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --gogo_out=plugins=grpc:. types/*.proto
@echo "--> adding nolint declarations to protobuf generated files"
@awk '/package types/ { print "//nolint: gas"; print; next }1' types/types.pb.go > types/types.pb.go.new
@mv types/types.pb.go.new types/types.pb.go
build:
@go build -i ./cmd/...
dist:
@bash scripts/dist.sh
@bash scripts/publish.sh
install_protoc:
# https://github.com/google/protobuf/releases
install:
@go install ./cmd/...
########################################
### Tools & dependencies
check_tools:
@# https://stackoverflow.com/a/25668869
@echo "Found tools: $(foreach tool,$(GOTOOLS_CHECK),\
$(if $(shell which $(tool)),$(tool),$(error "No $(tool) in PATH")))"
get_tools:
@echo "--> Installing tools"
go get -u -v $(GOTOOLS)
@gometalinter.v2 --install
get_protoc:
@# https://github.com/google/protobuf/releases
curl -L https://github.com/google/protobuf/releases/download/v3.4.1/protobuf-cpp-3.4.1.tar.gz | tar xvz && \
cd protobuf-3.4.1 && \
DIST_LANG=cpp ./configure && \
@ -21,60 +59,41 @@ install_protoc:
cd .. && \
rm -rf protobuf-3.4.1
protoc:
## Note to self:
## On "error while loading shared libraries: libprotobuf.so.14: cannot open shared object file: No such file or directory"
## ldconfig (may require sudo)
## https://stackoverflow.com/a/25518702
protoc $(INCLUDE) --gogo_out=plugins=grpc:. types/*.proto
@ echo "--> adding nolint declarations to protobuf generated files"
@ awk '/package types/ { print "//nolint: gas"; print; next }1' types/types.pb.go > types/types.pb.go.new
@ mv types/types.pb.go.new types/types.pb.go
update_tools:
@echo "--> Updating tools"
@go get -u $(GOTOOLS)
install:
@ go install ./cmd/...
get_vendor_deps:
@rm -rf vendor/
@echo "--> Running glide install"
@glide install
build:
@ go build -i ./cmd/...
dist:
@ bash scripts/dist.sh
@ bash scripts/publish.sh
########################################
### Testing
test:
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@ echo "==> Running go test"
@ go test $(PACKAGES)
@find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@echo "==> Running go test"
@go test $(PACKAGES)
test_race:
@ find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@ echo "==> Running go test --race"
@ go test -v -race $(PACKAGES)
@find . -path ./vendor -prune -o -name "*.sock" -exec rm {} \;
@echo "==> Running go test --race"
@go test -v -race $(PACKAGES)
test_integrations:
@ bash test.sh
fmt:
@ go fmt ./...
@bash test.sh
get_deps:
@ go get -d $(PACKAGES)
ensure_tools:
go get -u -v $(GOTOOLS)
#@ gometalinter.v2 --install
get_vendor_deps: ensure_tools
@ rm -rf vendor/
@ echo "--> Running glide install"
@ glide install
########################################
### Formatting, linting, and vetting
metalinter_all:
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
fmt:
@go fmt ./...
metalinter:
@ echo "==> Running linter"
@echo "==> Running linter"
gometalinter.v2 --vendor --deadline=600s --disable-all \
--enable=maligned \
--enable=deadcode \
@ -92,7 +111,6 @@ metalinter:
--enable=varcheck \
--enable=vetshadow \
./...
#--enable=gas \
#--enable=dupl \
#--enable=errcheck \
@ -103,10 +121,42 @@ metalinter:
#--enable=unparam \
#--enable=vet \
build-docker:
metalinter_all:
protoc $(INCLUDE) --lint_out=. types/*.proto
gometalinter.v2 --vendor --deadline=600s --enable-all --disable=lll ./...
########################################
### Docker
DEVDOC_SAVE = docker commit `docker ps -a -n 1 -q` devdoc:local
docker_build:
docker build -t "tendermint/abci-dev" -f Dockerfile.develop .
run-docker:
docker run -it --rm -v "$PWD:/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
docker_run:
docker run -it -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
docker_run_rm:
docker run -it --rm -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" "tendermint/abci-dev" /bin/bash
devdoc_init:
docker run -it -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" tendermint/devdoc echo
# TODO make this safer
$(call DEVDOC_SAVE)
devdoc:
docker run -it -v "$(CURDIR):/go/src/github.com/tendermint/abci" -w "/go/src/github.com/tendermint/abci" devdoc:local bash
devdoc_save:
# TODO make this safer
$(call DEVDOC_SAVE)
devdoc_clean:
docker rmi $$(docker images -f "dangling=true" -q)
.PHONY: all build test fmt get_deps ensure_tools protoc install_protoc build-docker run-docker
# To avoid unintended conflicts with file names, always add to .PHONY
# unless there is a reason not to.
# https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html
.PHONY: check protoc build dist install check_tools get_tools get_protoc update_tools get_vendor_deps test test_race test_integrations fmt metalinter metalinter_all docker_build docker_run docker_run_rm devdoc_init devdoc devdoc_save devdoc_clean

+ 98
- 141
README.md View File

@ -13,7 +13,34 @@ The two guides to focus on are the `Application Development Guide` and `Using AB
Previously, the ABCI was referred to as TMSP.
The community has provided a number of addtional implementations, see the `Tendermint Ecosystem` in [the documentation](http://tendermint.readthedocs.io/en/master/).
The community has provided a number of addtional implementations, see the [Tendermint Ecosystem](https://tendermint.com/ecosystem)
## Specification
The [primary specification](https://github.com/tendermint/abci/blob/master/types/types.proto)
is made using Protocol Buffers. To build it, run
```
make protoc
```
See `protoc --help` and [the Protocol Buffers site](https://developers.google.com/protocol-buffers)
for details on compiling for other languages. Note we also include a [GRPC](http://www.grpc.io/docs)
service definition.
For the specification as an interface in Go, see the
[types/application.go file](https://github.com/tendermint/abci/blob/master/types/application.go).
See the [spec file](specification.rst) for a detailed description of the message types.
## Install
```
go get github.com/tendermint/abci
cd $GOPATH/src/github.com/tendermint/abci
make get_vendor_deps
make install
```
## Implementation
@ -24,19 +51,21 @@ We provide three implementations of the ABCI in Go:
- GRPC
Note the GRPC version is maintained primarily to simplify onboarding and prototyping and is not receiving the same
attention to security and performance as the others.
attention to security and performance as the others
### In Process
The simplest implementation just uses function calls within Go.
This means ABCI applications written in Golang can be compiled with TendermintCore and run as a single binary.
See the [examples](#examples) below for more information.
### Socket (TSP)
ABCI is best implemented as a streaming protocol.
The socket implementation provides for asynchronous, ordered message passing over unix or tcp.
Messages are serialized using Protobuf3 and length-prefixed.
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.
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 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...`.
@ -48,156 +77,84 @@ the ordered, asynchronous socket protocol. The implementation has also not recei
Note the length-prefixing used in the socket implementation does not apply for GRPC.
## Tools
## Usage
The `abci-cli` tool wraps an ABCI client and can be used for probing/testing an ABCI server.
For instance, `abci-cli test` will run a test sequence against a listening server running the Counter application (see below).
It can also be used to run some example applications.
See [the documentation](http://tendermint.readthedocs.io/en/master/) for more details.
### Example Apps
### Examples
Multiple example apps are included:
- the `abci-cli counter` application, which illustrates nonce checking in txs
- the `abci-cli dummy` application, which illustrates a simple key-value Merkle tree
- the `abci-cli dummy --persistent` application, which augments the dummy with persistence and validator set changes
Check out the variety of example applications in the [example directory](example/).
It also contains the code refered to by the `counter` and `dummy` apps; these apps come
built into the `abci-cli` binary.
### Install
#### Counter
```
go get github.com/tendermint/abci
cd $GOPATH/src/github.com/tendermint/abci
make get_vendor_deps
make install
```
The `abci-cli counter` application illustrates nonce checking in transactions. It's code looks like:
## Specification
```golang
func cmdCounter(cmd *cobra.Command, args []string) error {
The [primary specification](https://github.com/tendermint/abci/blob/master/types/types.proto) is made using Protocol Buffers.
To build it, run
app := counter.NewCounterApplication(flagSerial)
```
make protoc
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Start the listener
srv, err := server.NewServer(flagAddrC, flagAbci, app)
if err != nil {
return err
}
srv.SetLogger(logger.With("module", "abci-server"))
if err := srv.Start(); err != nil {
return err
}
// Wait forever
cmn.TrapSignal(func() {
// Cleanup
srv.Stop()
})
return nil
}
```
See `protoc --help` and [the Protocol Buffers site](https://developers.google.com/protocol-buffers/) for details on compiling for other languages.
Note we also include a [GRPC](http://www.grpc.io/docs) service definition.
For the specification as an interface in Go, see the [types/application.go file](https://github.com/tendermint/abci/blob/master/types/application.go).
### Message Types
ABCI requests/responses are defined as simple Protobuf messages in [this schema file](https://github.com/tendermint/abci/blob/master/types/types.proto).
TendermintCore sends the requests, and the ABCI application sends the responses.
Here, we describe the requests and responses as function arguments and return values, and make some notes about usage:
#### Echo
* __Arguments__:
* `Message (string)`: A string to echo back
* __Returns__:
* `Message (string)`: The input string
* __Usage__:<br/>
* Echo a string to test an abci client/server implementation
#### Flush
* __Usage__:<br/>
* Signals that messages queued on the client should be flushed to the server. It is called periodically by the client implementation to ensure asynchronous requests are actually sent, and is called immediately to make a synchronous request, which returns when the Flush response comes back.
#### Info
* __Returns__:
* `Data (string)`: Some arbitrary information
* `Version (Version)`: Version information
* `LastBlockHeight (int64)`: Latest block for which the app has called Commit
* `LastBlockAppHash ([]byte)`: Latest result of Commit
* __Usage__:<br/>
Return information about the application state. Used to sync the app with Tendermint on crash/restart.
#### SetOption
* __Arguments__:
* `Key (string)`: Key to set
* `Value (string)`: Value to set for key
* __Returns__:
* `Code (uint32)`: Response code
* `Log (string)`: Debug or error message
* __Usage__:<br/>
Set application options. E.g. Key="mode", Value="mempool" for a mempool connection, or Key="mode", Value="consensus" for a consensus connection.
Other options are application specific.
#### InitChain
* __Arguments__:
* `Validators ([]Validator)`: Initial genesis validators
* __Usage__:<br/>
Called once upon genesis
#### Query
* __Arguments__:
* `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 (int64)`: The block height for which you want the query (default=0 returns data for the latest committed block). Note that this is the height of the block containing the application's Merkle root hash, which represents the state as it was after committing the block at Height-1
* `Prove (bool)`: Return Merkle proof with response if possible
* __Returns__:
* `Code (uint32)`: Response code
* `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 (int64)`: The block height from which data was derived. Note that this is the height of the block containing the application's Merkle root hash, which represents the state as it was after committing the block at Height-1
* `Log (string)`: Debug or error message
#### BeginBlock
* __Arguments__:
* `Hash ([]byte)`: The block's hash. This can be derived from the block header.
* `Header (struct{})`: The block header
* `AbsentValidators ([]int32)`: List of indices of validators not included in the LastCommit
* `ByzantineValidators ([]Evidence)`: List of evidence of validators that acted maliciously
* __Usage__:<br/>
Signals the beginning of a new block. Called prior to any DeliverTxs. The header is expected to at least contain the Height. The `AbsentValidators` and `ByzantineValidators` can be used to determine rewards and punishments for the validators.
#### CheckTx
* __Arguments__:
* `Data ([]byte)`: The request transaction bytes
* __Returns__:
* `Code (uint32)`: Response code
* `Data ([]byte)`: Result bytes, if any
* `Log (string)`: Debug or error message
* `Gas (int64)`: Amount of gas consumed by transaction
* `Fee (int64)`: Fee paid by transaction
* __Usage__:<br/>
Validate a mempool transaction, prior to broadcasting or proposing. This message should not mutate the main state, but application
developers may want to keep a separate CheckTx state that gets reset upon Commit.
CheckTx can happen interspersed with DeliverTx, but they happen on different ABCI connections - CheckTx from the mempool connection, and DeliverTx from the consensus connection. During Commit, the mempool is locked, so you can reset the mempool state to the latest state after running all those DeliverTxs, and then the mempool will re-run whatever txs it has against that latest mempool state.
Transactions are first run through CheckTx before broadcast to peers in the mempool layer.
You can make CheckTx semi-stateful and clear the state upon `Commit` or `BeginBlock`,
to allow for dependent sequences of transactions in the same block.
#### DeliverTx
* __Arguments__:
* `Data ([]byte)`: The request transaction bytes
* __Returns__:
* `Code (uint32)`: Response code
* `Data ([]byte)`: Result bytes, if any
* `Log (string)`: Debug or error message
* `Tags ([]*KVPair)`: Optional tags for indexing
* __Usage__:<br/>
Append and run a transaction. If the transaction is valid, returns CodeType.OK
#### EndBlock
* __Arguments__:
* `Height (int64)`: The block height that ended
* __Returns__:
* `ValidatorUpdates ([]Validator)`: Changes to validator set (set voting power to 0 to remove)
* `ConsensusParamUpdates (ConsensusParams)`: Changes to consensus-critical time/size parameters
* __Usage__:<br/>
Signals the end of a block. Called prior to each Commit after all transactions. Validator set is updated with the result.
#### Commit
* __Returns__:
* `Data ([]byte)`: The Merkle root hash
* `Log (string)`: Debug or error message
* __Usage__:<br/>
Return a Merkle root hash of the application state.
and can be found in [this file](cmd/abci-cli/abci-cli.go).
#### Dummy
The `abci-cli dummy` application, which illustrates a simple key-value Merkle tree
```golang
func cmdDummy(cmd *cobra.Command, args []string) error {
logger := log.NewTMLogger(log.NewSyncWriter(os.Stdout))
// Create the application - in memory or persisted to disk
var app types.Application
if flagPersist == "" {
app = dummy.NewDummyApplication()
} else {
app = dummy.NewPersistentDummyApplication(flagPersist)
app.(*dummy.PersistentDummyApplication).SetLogger(logger.With("module", "dummy"))
}
// Start the listener
srv, err := server.NewServer(flagAddrD, flagAbci, app)
if err != nil {
return err
}
srv.SetLogger(logger.With("module", "abci-server"))
if err := srv.Start(); err != nil {
return err
}
// Wait forever
cmn.TrapSignal(func() {
// Cleanup
srv.Stop()
})
return nil
}
```

+ 1
- 1
circle.yml View File

@ -15,7 +15,7 @@ checkout:
test:
override:
- cd $REPO && make get_vendor_deps && make test_integrations
- cd $REPO && make get_tools check get_vendor_deps install test_integrations
post:
- cd "$REPO" && bash <(curl -s https://codecov.io/bash) -f coverage.txt
- cd "$REPO" && mv coverage.txt "${CIRCLE_ARTIFACTS}"

+ 1
- 1
client/socket_client.go View File

@ -135,7 +135,7 @@ func (cli *socketClient) sendRequestsRoutine(conn net.Conn) {
default:
// Probably will fill the buffer, or retry later.
}
case <-cli.BaseService.Quit:
case <-cli.Quit():
return
case reqres := <-cli.reqQueue:
cli.willSendReq(reqres)


+ 73
- 50
cmd/abci-cli/abci-cli.go View File

@ -54,8 +54,8 @@ var (
var RootCmd = &cobra.Command{
Use: "abci-cli",
Short: "",
Long: "",
Short: "the ABCI CLI tool wraps an ABCI client",
Long: "the ABCI CLI tool wraps an ABCI client and is used for testing ABCI servers",
PersistentPreRunE: func(cmd *cobra.Command, args []string) error {
switch cmd.Use {
@ -92,6 +92,7 @@ type response struct {
// generic abci response
Data []byte
Code uint32
Info string
Log string
Query *queryResponse
@ -111,26 +112,26 @@ func Execute() error {
}
func addGlobalFlags() {
RootCmd.PersistentFlags().StringVarP(&flagAddress, "address", "", "tcp://0.0.0.0:46658", "Address of application socket")
RootCmd.PersistentFlags().StringVarP(&flagAbci, "abci", "", "socket", "Either socket or grpc")
RootCmd.PersistentFlags().BoolVarP(&flagVerbose, "verbose", "v", false, "Print the command and results as if it were a console session")
RootCmd.PersistentFlags().StringVarP(&flagLogLevel, "log_level", "", "debug", "Set the logger level")
RootCmd.PersistentFlags().StringVarP(&flagAddress, "address", "", "tcp://0.0.0.0:46658", "address of application socket")
RootCmd.PersistentFlags().StringVarP(&flagAbci, "abci", "", "socket", "either socket or grpc")
RootCmd.PersistentFlags().BoolVarP(&flagVerbose, "verbose", "v", false, "print the command and results as if it were a console session")
RootCmd.PersistentFlags().StringVarP(&flagLogLevel, "log_level", "", "debug", "set the logger level")
}
func addQueryFlags() {
queryCmd.PersistentFlags().StringVarP(&flagPath, "path", "", "/store", "Path to prefix query with")
queryCmd.PersistentFlags().IntVarP(&flagHeight, "height", "", 0, "Height to query the blockchain at")
queryCmd.PersistentFlags().BoolVarP(&flagProve, "prove", "", false, "Whether or not to return a merkle proof of the query result")
queryCmd.PersistentFlags().StringVarP(&flagPath, "path", "", "/store", "path to prefix query with")
queryCmd.PersistentFlags().IntVarP(&flagHeight, "height", "", 0, "height to query the blockchain at")
queryCmd.PersistentFlags().BoolVarP(&flagProve, "prove", "", false, "whether or not to return a merkle proof of the query result")
}
func addCounterFlags() {
counterCmd.PersistentFlags().StringVarP(&flagAddrC, "addr", "", "tcp://0.0.0.0:46658", "Listen address")
counterCmd.PersistentFlags().BoolVarP(&flagSerial, "serial", "", false, "Enforce incrementing (serial) transactions")
counterCmd.PersistentFlags().StringVarP(&flagAddrC, "addr", "", "tcp://0.0.0.0:46658", "listen address")
counterCmd.PersistentFlags().BoolVarP(&flagSerial, "serial", "", false, "enforce incrementing (serial) transactions")
}
func addDummyFlags() {
dummyCmd.PersistentFlags().StringVarP(&flagAddrD, "addr", "", "tcp://0.0.0.0:46658", "Listen address")
dummyCmd.PersistentFlags().StringVarP(&flagPersist, "persist", "", "", "Directory to use for a database")
dummyCmd.PersistentFlags().StringVarP(&flagAddrD, "addr", "", "tcp://0.0.0.0:46658", "listen address")
dummyCmd.PersistentFlags().StringVarP(&flagPersist, "persist", "", "", "directory to use for a database")
}
func addCommands() {
RootCmd.AddCommand(batchCmd)
@ -155,18 +156,39 @@ func addCommands() {
var batchCmd = &cobra.Command{
Use: "batch",
Short: "Run a batch of abci commands against an application",
Long: "",
Args: cobra.ExactArgs(0),
Short: "run a batch of abci commands against an application",
Long: `run a batch of abci commands against an application
This command is run by piping in a file containing a series of commands
you'd like to run:
abci-cli batch < example.file
where example.file looks something like:
set_option serial on
check_tx 0x00
check_tx 0xff
deliver_tx 0x00
check_tx 0x00
deliver_tx 0x01
deliver_tx 0x04
info
`,
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdBatch(cmd, args)
},
}
var consoleCmd = &cobra.Command{
Use: "console",
Short: "Start an interactive abci console for multiple commands",
Long: "",
Use: "console",
Short: "start an interactive ABCI console for multiple commands",
Long: `start an interactive ABCI console for multiple commands
This command opens an interactive console for running any of the other commands
without opening a new connection each time
`,
Args: cobra.ExactArgs(0),
ValidArgs: []string{"echo", "info", "set_option", "deliver_tx", "check_tx", "commit", "query"},
RunE: func(cmd *cobra.Command, args []string) error {
@ -176,8 +198,8 @@ var consoleCmd = &cobra.Command{
var echoCmd = &cobra.Command{
Use: "echo",
Short: "Have the application echo a message",
Long: "",
Short: "have the application echo a message",
Long: "have the application echo a message",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdEcho(cmd, args)
@ -185,8 +207,8 @@ var echoCmd = &cobra.Command{
}
var infoCmd = &cobra.Command{
Use: "info",
Short: "Get some info about the application",
Long: "",
Short: "get some info about the application",
Long: "get some info about the application",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdInfo(cmd, args)
@ -194,8 +216,8 @@ var infoCmd = &cobra.Command{
}
var setOptionCmd = &cobra.Command{
Use: "set_option",
Short: "Set an option on the application",
Long: "",
Short: "set an option on the application",
Long: "set an option on the application",
Args: cobra.ExactArgs(2),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdSetOption(cmd, args)
@ -204,8 +226,8 @@ var setOptionCmd = &cobra.Command{
var deliverTxCmd = &cobra.Command{
Use: "deliver_tx",
Short: "Deliver a new transaction to the application",
Long: "",
Short: "deliver a new transaction to the application",
Long: "deliver a new transaction to the application",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdDeliverTx(cmd, args)
@ -214,8 +236,8 @@ var deliverTxCmd = &cobra.Command{
var checkTxCmd = &cobra.Command{
Use: "check_tx",
Short: "Validate a transaction",
Long: "",
Short: "validate a transaction",
Long: "validate a transaction",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdCheckTx(cmd, args)
@ -224,8 +246,8 @@ var checkTxCmd = &cobra.Command{
var commitCmd = &cobra.Command{
Use: "commit",
Short: "Commit the application state and return the Merkle root hash",
Long: "",
Short: "commit the application state and return the Merkle root hash",
Long: "commit the application state and return the Merkle root hash",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdCommit(cmd, args)
@ -234,8 +256,8 @@ var commitCmd = &cobra.Command{
var versionCmd = &cobra.Command{
Use: "version",
Short: "Print abci console version",
Long: "",
Short: "print ABCI console version",
Long: "print ABCI console version",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
fmt.Println(version.Version)
@ -245,8 +267,8 @@ var versionCmd = &cobra.Command{
var queryCmd = &cobra.Command{
Use: "query",
Short: "Query the application state",
Long: "",
Short: "query the application state",
Long: "query the application state",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdQuery(cmd, args)
@ -256,7 +278,7 @@ var queryCmd = &cobra.Command{
var counterCmd = &cobra.Command{
Use: "counter",
Short: "ABCI demo example",
Long: "",
Long: "ABCI demo example",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdCounter(cmd, args)
@ -266,7 +288,7 @@ var counterCmd = &cobra.Command{
var dummyCmd = &cobra.Command{
Use: "dummy",
Short: "ABCI demo example",
Long: "",
Long: "ABCI demo example",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdDummy(cmd, args)
@ -275,8 +297,8 @@ var dummyCmd = &cobra.Command{
var testCmd = &cobra.Command{
Use: "test",
Short: "Run integration tests",
Long: "",
Short: "run integration tests",
Long: "run integration tests",
Args: cobra.ExactArgs(0),
RunE: func(cmd *cobra.Command, args []string) error {
return cmdTest(cmd, args)
@ -327,8 +349,10 @@ func cmdTest(cmd *cobra.Command, args []string) error {
func() error { return servertest.DeliverTx(client, []byte{0x00, 0x02}, code.CodeTypeOK, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x00, 0x03}, code.CodeTypeOK, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x00, 0x00, 0x04}, code.CodeTypeOK, nil) },
func() error { return servertest.DeliverTx(client, []byte{0x00, 0x00, 0x06}, code.CodeTypeBadNonce, nil) },
func() error { return servertest.Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5})},
func() error {
return servertest.DeliverTx(client, []byte{0x00, 0x00, 0x06}, code.CodeTypeBadNonce, nil)
},
func() error { return servertest.Commit(client, []byte{0, 0, 0, 0, 0, 0, 0, 5}) },
})
}
@ -496,14 +520,11 @@ func cmdSetOption(cmd *cobra.Command, args []string) error {
}
key, val := args[0], args[1]
res, err := client.SetOptionSync(types.RequestSetOption{key, val})
_, err := client.SetOptionSync(types.RequestSetOption{key, val})
if err != nil {
return err
}
printResponse(cmd, args, response{
Code: res.Code,
Log: res.Log,
})
printResponse(cmd, args, response{Log: "OK (SetOption doesn't return anything.)"}) // NOTE: Nothing to show...
return nil
}
@ -527,6 +548,7 @@ func cmdDeliverTx(cmd *cobra.Command, args []string) error {
printResponse(cmd, args, response{
Code: res.Code,
Data: res.Data,
Info: res.Info,
Log: res.Log,
})
return nil
@ -537,7 +559,7 @@ func cmdCheckTx(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
printResponse(cmd, args, response{
Code: codeBad,
Log: "want the tx",
Info: "want the tx",
})
return nil
}
@ -552,6 +574,7 @@ func cmdCheckTx(cmd *cobra.Command, args []string) error {
printResponse(cmd, args, response{
Code: res.Code,
Data: res.Data,
Info: res.Info,
Log: res.Log,
})
return nil
@ -564,9 +587,7 @@ func cmdCommit(cmd *cobra.Command, args []string) error {
return err
}
printResponse(cmd, args, response{
Code: res.Code,
Data: res.Data,
Log: res.Log,
})
return nil
}
@ -576,7 +597,8 @@ func cmdQuery(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
printResponse(cmd, args, response{
Code: codeBad,
Log: "want the query",
Info: "want the query",
Log: "",
})
return nil
}
@ -596,6 +618,7 @@ func cmdQuery(cmd *cobra.Command, args []string) error {
}
printResponse(cmd, args, response{
Code: resQuery.Code,
Info: resQuery.Info,
Log: resQuery.Log,
Query: &queryResponse{
Key: resQuery.Key,


+ 0
- 2
example/code/code.go View File

@ -6,6 +6,4 @@ const (
CodeTypeEncodingError uint32 = 1
CodeTypeBadNonce uint32 = 2
CodeTypeUnauthorized uint32 = 3
CodeTypeBadOption uint32 = 101
)

+ 11
- 9
example/counter/counter.go View File

@ -30,15 +30,17 @@ func (app *CounterApplication) SetOption(req types.RequestSetOption) types.Respo
if key == "serial" && value == "on" {
app.serial = true
} else {
return types.ResponseSetOption{
Code: code.CodeTypeBadOption,
Log: cmn.Fmt("Unknown key (%s) or value (%s)", key, value),
}
/*
TODO Panic and have the ABCI server pass an exception.
The client can call SetOptionSync() and get an `error`.
return types.ResponseSetOption{
Error: cmn.Fmt("Unknown key (%s) or value (%s)", key, value),
}
*/
return types.ResponseSetOption{}
}
return types.ResponseSetOption{
Code: code.CodeTypeOK,
}
return types.ResponseSetOption{}
}
func (app *CounterApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
@ -83,11 +85,11 @@ func (app *CounterApplication) CheckTx(tx []byte) types.ResponseCheckTx {
func (app *CounterApplication) Commit() (resp types.ResponseCommit) {
app.hashCount++
if app.txCount == 0 {
return types.ResponseCommit{Code: code.CodeTypeOK}
return types.ResponseCommit{}
}
hash := make([]byte, 8)
binary.BigEndian.PutUint64(hash, uint64(app.txCount))
return types.ResponseCommit{Code: code.CodeTypeOK, Data: hash}
return types.ResponseCommit{Data: hash}
}
func (app *CounterApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {


+ 59
- 32
example/dummy/dummy.go View File

@ -2,30 +2,70 @@ package dummy
import (
"bytes"
"encoding/binary"
"encoding/json"
"fmt"
"github.com/tendermint/abci/example/code"
"github.com/tendermint/abci/types"
wire "github.com/tendermint/go-wire"
"github.com/tendermint/iavl"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
)
var (
stateKey = []byte("stateKey")
kvPairPrefixKey = []byte("kvPairKey:")
)
type State struct {
db dbm.DB
Size int64 `json:"size"`
Height int64 `json:"height"`
AppHash []byte `json:"app_hash"`
}
func loadState(db dbm.DB) State {
stateBytes := db.Get(stateKey)
var state State
if len(stateBytes) != 0 {
err := json.Unmarshal(stateBytes, &state)
if err != nil {
panic(err)
}
}
state.db = db
return state
}
func saveState(state State) {
stateBytes, err := json.Marshal(state)
if err != nil {
panic(err)
}
state.db.Set(stateKey, stateBytes)
}
func prefixKey(key []byte) []byte {
return append(kvPairPrefixKey, key...)
}
//---------------------------------------------------
var _ types.Application = (*DummyApplication)(nil)
type DummyApplication struct {
types.BaseApplication
state *iavl.VersionedTree
state State
}
func NewDummyApplication() *DummyApplication {
state := iavl.NewVersionedTree(0, dbm.NewMemDB())
state := loadState(dbm.NewMemDB())
return &DummyApplication{state: state}
}
func (app *DummyApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo) {
return types.ResponseInfo{Data: fmt.Sprintf("{\"size\":%v}", app.state.Size())}
return types.ResponseInfo{Data: fmt.Sprintf("{\"size\":%v}", app.state.Size)}
}
// tx is either "key=value" or just arbitrary bytes
@ -37,11 +77,12 @@ func (app *DummyApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
} else {
key, value = tx, tx
}
app.state.Set(key, value)
app.state.db.Set(prefixKey(key), value)
app.state.Size += 1
tags := []*types.KVPair{
{Key: "app.creator", ValueType: types.KVPair_STRING, ValueString: "jae"},
{Key: "app.key", ValueType: types.KVPair_STRING, ValueString: string(key)},
tags := []cmn.KVPair{
{[]byte("app.creator"), []byte("jae")},
{[]byte("app.key"), key},
}
return types.ResponseDeliverTx{Code: code.CodeTypeOK, Tags: tags}
}
@ -51,34 +92,21 @@ func (app *DummyApplication) CheckTx(tx []byte) types.ResponseCheckTx {
}
func (app *DummyApplication) Commit() types.ResponseCommit {
// Save a new version
var hash []byte
var err error
if app.state.Size() > 0 {
// just add one more to height (kind of arbitrarily stupid)
height := app.state.LatestVersion() + 1
hash, err = app.state.SaveVersion(height)
if err != nil {
// if this wasn't a dummy app, we'd do something smarter
panic(err)
}
}
return types.ResponseCommit{Code: code.CodeTypeOK, Data: hash}
// Using a memdb - just return the big endian size of the db
appHash := make([]byte, 8)
binary.PutVarint(appHash, app.state.Size)
app.state.AppHash = appHash
app.state.Height += 1
saveState(app.state)
return types.ResponseCommit{Data: appHash}
}
func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery) {
if reqQuery.Prove {
value, proof, err := app.state.GetWithProof(reqQuery.Data)
// if this wasn't a dummy app, we'd do something smarter
if err != nil {
panic(err)
}
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Index = -1 // TODO make Proof return index
resQuery.Key = reqQuery.Data
resQuery.Value = value
resQuery.Proof = wire.BinaryBytes(proof)
if value != nil {
resQuery.Log = "exists"
} else {
@ -86,8 +114,7 @@ func (app *DummyApplication) Query(reqQuery types.RequestQuery) (resQuery types.
}
return
} else {
index, value := app.state.Get(reqQuery.Data)
resQuery.Index = int64(index)
value := app.state.db.Get(prefixKey(reqQuery.Data))
resQuery.Value = value
if value != nil {
resQuery.Log = "exists"


+ 12
- 19
example/dummy/dummy_test.go View File

@ -8,7 +8,6 @@ import (
"github.com/stretchr/testify/require"
"github.com/tendermint/iavl"
cmn "github.com/tendermint/tmlibs/common"
"github.com/tendermint/tmlibs/log"
@ -41,10 +40,6 @@ func testDummy(t *testing.T, app types.Application, tx []byte, key, value string
})
require.EqualValues(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
proof, err := iavl.ReadKeyExistsProof(resQuery.Proof)
require.Nil(t, err)
err = proof.Verify([]byte(key), resQuery.Value, proof.RootHash)
require.Nil(t, err, "%+v", err) // NOTE: we have no way to verify the RootHash
}
func TestDummyKV(t *testing.T) {
@ -92,7 +87,7 @@ func TestPersistentDummyInfo(t *testing.T) {
// make and apply block
height = int64(1)
hash := []byte("foo")
header := &types.Header{
header := types.Header{
Height: int64(height),
}
dummy.BeginBlock(types.RequestBeginBlock{hash, header, nil, nil})
@ -119,16 +114,18 @@ func TestValUpdates(t *testing.T) {
nInit := 5
vals := RandVals(total)
// iniitalize with the first nInit
dummy.InitChain(types.RequestInitChain{vals[:nInit]})
dummy.InitChain(types.RequestInitChain{
Validators: vals[:nInit],
})
vals1, vals2 := vals[:nInit], dummy.Validators()
valsEqual(t, vals1, vals2)
var v1, v2, v3 *types.Validator
var v1, v2, v3 types.Validator
// add some validators
v1, v2 = vals[nInit], vals[nInit+1]
diff := []*types.Validator{v1, v2}
diff := []types.Validator{v1, v2}
tx1 := MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 := MakeValSetChangeTx(v2.PubKey, v2.Power)
@ -142,7 +139,7 @@ func TestValUpdates(t *testing.T) {
v1.Power = 0
v2.Power = 0
v3.Power = 0
diff = []*types.Validator{v1, v2, v3}
diff = []types.Validator{v1, v2, v3}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
tx2 = MakeValSetChangeTx(v2.PubKey, v2.Power)
tx3 := MakeValSetChangeTx(v3.PubKey, v3.Power)
@ -160,22 +157,22 @@ func TestValUpdates(t *testing.T) {
} else {
v1.Power = 5
}
diff = []*types.Validator{v1}
diff = []types.Validator{v1}
tx1 = MakeValSetChangeTx(v1.PubKey, v1.Power)
makeApplyBlock(t, dummy, 3, diff, tx1)
vals1 = append([]*types.Validator{v1}, vals1[1:]...)
vals1 = append([]types.Validator{v1}, vals1[1:]...)
vals2 = dummy.Validators()
valsEqual(t, vals1, vals2)
}
func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff []*types.Validator, txs ...[]byte) {
func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff []types.Validator, txs ...[]byte) {
// make and apply block
height := int64(heightInt)
hash := []byte("foo")
header := &types.Header{
header := types.Header{
Height: height,
}
@ -193,7 +190,7 @@ func makeApplyBlock(t *testing.T, dummy types.Application, heightInt int, diff [
}
// order doesn't matter
func valsEqual(t *testing.T, vals1, vals2 []*types.Validator) {
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))
}
@ -310,8 +307,4 @@ func testClient(t *testing.T, app abcicli.Client, tx []byte, key, value string)
require.Nil(t, err)
require.Equal(t, code.CodeTypeOK, resQuery.Code)
require.Equal(t, value, string(resQuery.Value))
proof, err := iavl.ReadKeyExistsProof(resQuery.Proof)
require.Nil(t, err)
err = proof.Verify([]byte(key), resQuery.Value, proof.RootHash)
require.Nil(t, err, "%+v", err) // NOTE: we have no way to verify the RootHash
}

+ 9
- 7
example/dummy/helpers.go View File

@ -2,24 +2,23 @@ package dummy
import (
"github.com/tendermint/abci/types"
crypto "github.com/tendermint/go-crypto"
cmn "github.com/tendermint/tmlibs/common"
)
// RandVal creates one random validator, with a key derived
// from the input value
func RandVal(i int) *types.Validator {
pubkey := crypto.GenPrivKeyEd25519FromSecret([]byte(cmn.Fmt("test%d", i))).PubKey().Bytes()
func RandVal(i int) types.Validator {
pubkey := cmn.RandBytes(33)
power := cmn.RandUint16() + 1
return &types.Validator{pubkey, int64(power)}
return types.Validator{pubkey, int64(power)}
}
// RandVals returns a list of cnt validators for initializing
// the application. Note that the keys are deterministically
// derived from the index in the array, while the power is
// random (Change this if not desired)
func RandVals(cnt int) []*types.Validator {
res := make([]*types.Validator, cnt)
func RandVals(cnt int) []types.Validator {
res := make([]types.Validator, cnt)
for i := 0; i < cnt; i++ {
res[i] = RandVal(i)
}
@ -30,5 +29,8 @@ func RandVals(cnt int) []*types.Validator {
// which allows tests to pass and is fine as long as you
// don't make any tx that modify the validator state
func InitDummy(app *PersistentDummyApplication) {
app.InitChain(types.RequestInitChain{RandVals(1)})
app.InitChain(types.RequestInitChain{
Validators: RandVals(1),
AppStateBytes: []byte("[]"),
})
}

+ 22
- 39
example/dummy/persistent_dummy.go View File

@ -9,8 +9,6 @@ import (
"github.com/tendermint/abci/example/code"
"github.com/tendermint/abci/types"
crypto "github.com/tendermint/go-crypto"
"github.com/tendermint/iavl"
cmn "github.com/tendermint/tmlibs/common"
dbm "github.com/tendermint/tmlibs/db"
"github.com/tendermint/tmlibs/log"
@ -28,7 +26,7 @@ type PersistentDummyApplication struct {
app *DummyApplication
// validator set
ValUpdates []*types.Validator
ValUpdates []types.Validator
logger log.Logger
}
@ -40,11 +38,10 @@ func NewPersistentDummyApplication(dbDir string) *PersistentDummyApplication {
panic(err)
}
stateTree := iavl.NewVersionedTree(500, db)
stateTree.Load()
state := loadState(db)
return &PersistentDummyApplication{
app: &DummyApplication{state: stateTree},
app: &DummyApplication{state: state},
logger: log.NewNopLogger(),
}
}
@ -55,9 +52,8 @@ func (app *PersistentDummyApplication) SetLogger(l log.Logger) {
func (app *PersistentDummyApplication) Info(req types.RequestInfo) types.ResponseInfo {
res := app.app.Info(req)
var latestVersion uint64 = app.app.state.LatestVersion() // TODO: change to int64
res.LastBlockHeight = int64(latestVersion)
res.LastBlockAppHash = app.app.state.Hash()
res.LastBlockHeight = app.app.state.Height
res.LastBlockAppHash = app.app.state.AppHash
return res
}
@ -85,20 +81,7 @@ func (app *PersistentDummyApplication) CheckTx(tx []byte) types.ResponseCheckTx
// Commit will panic if InitChain was not called
func (app *PersistentDummyApplication) Commit() types.ResponseCommit {
// Save a new version for next height
height := app.app.state.LatestVersion() + 1
var appHash []byte
var err error
appHash, err = app.app.state.SaveVersion(height)
if err != nil {
// if this wasn't a dummy app, we'd do something smarter
panic(err)
}
app.logger.Info("Commit block", "height", height, "root", appHash)
return types.ResponseCommit{Code: code.CodeTypeOK, Data: appHash}
return app.app.Commit()
}
func (app *PersistentDummyApplication) Query(reqQuery types.RequestQuery) types.ResponseQuery {
@ -119,7 +102,7 @@ func (app *PersistentDummyApplication) InitChain(req types.RequestInitChain) typ
// Track the block hash and header information
func (app *PersistentDummyApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock {
// reset valset changes
app.ValUpdates = make([]*types.Validator, 0)
app.ValUpdates = make([]types.Validator, 0)
return types.ResponseBeginBlock{}
}
@ -131,18 +114,18 @@ func (app *PersistentDummyApplication) EndBlock(req types.RequestEndBlock) types
//---------------------------------------------
// update validators
func (app *PersistentDummyApplication) Validators() (validators []*types.Validator) {
app.app.state.Iterate(func(key, value []byte) bool {
if isValidatorTx(key) {
func (app *PersistentDummyApplication) Validators() (validators []types.Validator) {
itr := app.app.state.db.Iterator(nil, nil)
for ; itr.Valid(); itr.Next() {
if isValidatorTx(itr.Key()) {
validator := new(types.Validator)
err := types.ReadMessage(bytes.NewBuffer(value), validator)
err := types.ReadMessage(bytes.NewBuffer(itr.Value()), validator)
if err != nil {
panic(err)
}
validators = append(validators, validator)
validators = append(validators, *validator)
}
return false
})
}
return
}
@ -174,12 +157,12 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Response
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Pubkey (%s) is invalid hex", pubkeyS)}
}
_, err = crypto.PubKeyFromBytes(pubkey)
/*_, err = crypto.PubKeyFromBytes(pubkey)
if err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Pubkey (%X) is invalid go-crypto encoded", pubkey)}
}
}*/
// decode the power
power, err := strconv.ParseInt(powerS, 10, 64)
@ -190,29 +173,29 @@ func (app *PersistentDummyApplication) execValidatorTx(tx []byte) types.Response
}
// update
return app.updateValidator(&types.Validator{pubkey, power})
return app.updateValidator(types.Validator{pubkey, power})
}
// add, update, or remove a validator
func (app *PersistentDummyApplication) updateValidator(v *types.Validator) types.ResponseDeliverTx {
func (app *PersistentDummyApplication) updateValidator(v types.Validator) types.ResponseDeliverTx {
key := []byte("val:" + string(v.PubKey))
if v.Power == 0 {
// remove validator
if !app.app.state.Has(key) {
if !app.app.state.db.Has(key) {
return types.ResponseDeliverTx{
Code: code.CodeTypeUnauthorized,
Log: fmt.Sprintf("Cannot remove non-existent validator %X", key)}
}
app.app.state.Remove(key)
app.app.state.db.Delete(key)
} else {
// add or update validator
value := bytes.NewBuffer(make([]byte, 0))
if err := types.WriteMessage(v, value); err != nil {
if err := types.WriteMessage(&v, value); err != nil {
return types.ResponseDeliverTx{
Code: code.CodeTypeEncodingError,
Log: fmt.Sprintf("Error encoding validator: %v", err)}
}
app.app.state.Set(key, value.Bytes())
app.app.state.db.Set(key, value.Bytes())
}
// we only update the changes array if we successfully updated the tree


+ 17
- 48
glide.lock View File

@ -1,34 +1,27 @@
hash: 6cb2c869c8ce7d9e43b1e8930b9b1bc974ebb3d36d4b704fc78b77efba956a13
updated: 2017-11-30T17:08:29.176515576-05:00
hash: cff2757779ef879f0c625c42af37fb3e486afd93ab9a91175c2458a719faac66
updated: 2018-02-20T22:02:37.638875125-05:00
imports:
- name: github.com/btcsuite/btcd
version: 2e60448ffcc6bf78332d1fe590260095f554dd78
subpackages:
- btcec
- name: github.com/go-kit/kit
version: e3b2152e0063c5f05efea89ecbe297852af2a92d
version: 4dc7be5d2d12881735283bcab7352178e190fc71
subpackages:
- log
- log/level
- log/term
- name: github.com/go-logfmt/logfmt
version: 390ab7935ee28ec6b286364bba9b4dd6410cb3d5
- name: github.com/go-playground/locales
version: e4cbcb5d0652150d40ad0646651076b6bd2be4f6
subpackages:
- currency
- name: github.com/go-playground/universal-translator
version: 71201497bace774495daed26a3874fd339e0b538
- name: github.com/go-stack/stack
version: 259ab82a6cad3992b4e21ff5cac294ccb06474bc
- name: github.com/gogo/protobuf
version: 342cbe0a04158f6dcb03ca0079991a51a4248c02
version: 1adfc126b41513cc696b209667c8656ea7aac67c
subpackages:
- gogoproto
- jsonpb
- proto
- protoc-gen-gogo/descriptor
- sortkeys
- types
- name: github.com/golang/protobuf
version: 1e59b77b52bf8e4b449a57e6f79f21226d571845
version: 925541529c1fa6821df4e44ce2723319eb2be768
subpackages:
- proto
- ptypes
@ -44,13 +37,13 @@ imports:
- name: github.com/kr/logfmt
version: b84e30acd515aadc4b783ad4ff83aff3299bdfe0
- name: github.com/pkg/errors
version: f15c970de5b76fac0b59abb32d62c17cc7bed265
version: 645ef00459ed84a119197bfb8d8205042c6df63d
- name: github.com/spf13/cobra
version: 7b2c5ac9fc04fc5efafb60700713d4fa609b777b
- name: github.com/spf13/pflag
version: 4c012f6dcd9546820e378d0bdda4d8fc772cdfea
- name: github.com/syndtr/goleveldb
version: adf24ef3f94bd13ec4163060b21a5678f22b429b
version: 211f780988068502fe874c44dae530528ebd840f
subpackages:
- leveldb
- leveldb/cache
@ -64,37 +57,15 @@ imports:
- leveldb/storage
- leveldb/table
- leveldb/util
- name: github.com/tendermint/ed25519
version: d8387025d2b9d158cf4efb07e7ebf814bcce2057
subpackages:
- edwards25519
- extra25519
- name: github.com/tendermint/go-crypto
version: b4f04f196cd719660e43b91202cd60d9a95b1837
- name: github.com/tendermint/go-wire
version: 5ab49b4c6ad674da6b81442911cf713ef0afb544
subpackages:
- data
- name: github.com/tendermint/iavl
version: 595f3dcd5b6cd4a292e90757ae6d367fd7a6e653
- name: github.com/tendermint/tmlibs
version: 21fb7819891997c96838308b4eba5a50b07ff03f
version: 1b9b5652a199ab0be2e781393fb275b66377309d
subpackages:
- common
- db
- log
- process
- name: golang.org/x/crypto
version: 94eea52f7b742c7cbe0b03b22f0c4c8631ece122
subpackages:
- nacl/secretbox
- openpgp/armor
- openpgp/errors
- poly1305
- ripemd160
- salsa20/salsa
- name: golang.org/x/net
version: a8b9294777976932365dabb6640cf1468d95c70f
version: 2fb46b16b8dda405028c50f7c7f0f9dd1fa6bfb1
subpackages:
- context
- http2
@ -104,14 +75,14 @@ imports:
- lex/httplex
- trace
- name: golang.org/x/text
version: 75cc3cad82b5f47d3fb229ddda8c5167da14f294
version: e19ae1496984b1c655b8044a65c0300a3c878dd3
subpackages:
- secure/bidirule
- transform
- unicode/bidi
- unicode/norm
- name: google.golang.org/genproto
version: 7f0da29060c682909f650ad8ed4e515bd74fa12a
version: 4eb30f4778eed4c258ba66527a0d4f9ec8a36c45
subpackages:
- googleapis/rpc/status
- name: google.golang.org/grpc
@ -133,19 +104,17 @@ imports:
- status
- tap
- transport
- name: gopkg.in/go-playground/validator.v9
version: 61caf9d3038e1af346dbf5c2e16f6678e1548364
testImports:
- name: github.com/davecgh/go-spew
version: 04cdfd42973bb9c8589fd6a731800cf222fde1a9
version: 346938d642f2ec3594ed81d874461961cd0faa76
subpackages:
- spew
- name: github.com/pmezard/go-difflib
version: d8ed2627bdf02c080bf22230dbb337003b7aba2d
version: 792786c7400a136282c1664665ae0a8db921c6c2
subpackages:
- difflib
- name: github.com/stretchr/testify
version: 2aa2c176b9dab406a6970f6a55f513e8a8c8b18f
version: 12b6f73e6084dad08a7c6e575284b177ecafbc71
subpackages:
- assert
- require

+ 5
- 10
glide.yaml View File

@ -1,21 +1,15 @@
package: github.com/tendermint/abci
import:
- package: github.com/gogo/protobuf
version: v0.5
version: ^1.0.0
subpackages:
- proto
- package: github.com/pkg/errors
version: v0.8.0
- package: github.com/spf13/cobra
version: v0.0.1
- package: github.com/tendermint/go-crypto
version: develop
- package: github.com/tendermint/go-wire
version: develop
subpackages:
- data
- package: github.com/tendermint/iavl
version: develop
- package: github.com/tendermint/tmlibs
version: develop
version: v0.7.0
subpackages:
- common
- db
@ -28,6 +22,7 @@ import:
version: v1.7.3
testImport:
- package: github.com/stretchr/testify
version: v1.2.1
subpackages:
- assert
- require

+ 13
- 13
scripts/dist_build.sh View File

@ -19,7 +19,7 @@ XC_ARCH=${XC_ARCH:-"386 amd64 arm"}
XC_OS=${XC_OS:-"solaris darwin freebsd linux windows"}
# Make sure build tools are available.
make tools
make get_tools
# Get VENDORED dependencies
make get_vendor_deps
@ -29,23 +29,23 @@ BINARY="abci-cli"
# Build!
echo "==> Building..."
"$(which gox)" \
-os="${XC_OS}" \
-arch="${XC_ARCH}" \
-osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
-ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
-output "build/pkg/{{.OS}}_{{.Arch}}/$BINARY" \
-tags="${BUILD_TAGS}" \
github.com/tendermint/abci/cmd/$BINARY
-os="${XC_OS}" \
-arch="${XC_ARCH}" \
-osarch="!darwin/arm !solaris/amd64 !freebsd/amd64" \
-ldflags "-X ${GIT_IMPORT}.GitCommit='${GIT_COMMIT}' -X ${GIT_IMPORT}.GitDescribe='${GIT_DESCRIBE}'" \
-output "build/pkg/{{.OS}}_{{.Arch}}/$BINARY" \
-tags="${BUILD_TAGS}" \
github.com/tendermint/abci/cmd/$BINARY
# Zip all the files.
echo "==> Packaging..."
for PLATFORM in $(find ./build/pkg -mindepth 1 -maxdepth 1 -type d); do
OSARCH=$(basename "${PLATFORM}")
echo "--> ${OSARCH}"
OSARCH=$(basename "${PLATFORM}")
echo "--> ${OSARCH}"
pushd "$PLATFORM" >/dev/null 2>&1
zip "../${OSARCH}.zip" ./*
popd >/dev/null 2>&1
pushd "$PLATFORM" >/dev/null 2>&1
zip "../${OSARCH}.zip" ./*
popd >/dev/null 2>&1
done


+ 205
- 0
specification.rst View File

@ -0,0 +1,205 @@
Specification
=============
Message Types
~~~~~~~~~~~~~
ABCI requests/responses are defined as simple Protobuf messages in `this
schema
file <https://github.com/tendermint/abci/blob/master/types/types.proto>`__.
TendermintCore sends the requests, and the ABCI application sends the
responses. Here, we describe the requests and responses as function
arguments and return values, and make some notes about usage:
Echo
^^^^
- **Arguments**:
- ``Message (string)``: A string to echo back
- **Returns**:
- ``Message (string)``: The input string
- **Usage**:
- Echo a string to test an abci client/server implementation
Flush
^^^^^
- **Usage**:
- Signals that messages queued on the client should be flushed to
the server. It is called periodically by the client implementation
to ensure asynchronous requests are actually sent, and is called
immediately to make a synchronous request, which returns when the
Flush response comes back.
Info
^^^^
- **Returns**:
- ``Data (string)``: Some arbitrary information
- ``Version (Version)``: Version information
- ``LastBlockHeight (int64)``: Latest block for which the app has
called Commit
- ``LastBlockAppHash ([]byte)``: Latest result of Commit
- **Usage**: Return information about the application state. Used to
sync the app with Tendermint on crash/restart.
SetOption
^^^^^^^^^
- **Arguments**:
- ``Key (string)``: Key to set
- ``Value (string)``: Value to set for key
- **Returns**:
- ``Code (uint32)``: Response code
- ``Log (string)``: Debug or error message
- **Usage**: Set application options. E.g. Key="mode", Value="mempool"
for a mempool connection, or Key="mode", Value="consensus" for a
consensus connection. Other options are application specific.
InitChain
^^^^^^^^^
- **Arguments**:
- ``Validators ([]Validator)``: Initial genesis validators
- ``AppStateBytes ([]byte)``: Serialized initial application state
- **Usage**: Called once upon genesis
Query
^^^^^
- **Arguments**:
- ``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 (int64)``: The block height for which you want the query
(default=0 returns data for the latest committed block). Note that
this is the height of the block containing the application's
Merkle root hash, which represents the state as it was after
committing the block at Height-1
- ``Prove (bool)``: Return Merkle proof with response if possible
- **Returns**:
- ``Code (uint32)``: Response code
- ``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 (int64)``: The block height from which data was derived.
Note that this is the height of the block containing the
application's Merkle root hash, which represents the state as it
was after committing the block at Height-1
- ``Log (string)``: Debug or error message
BeginBlock
^^^^^^^^^^
- **Arguments**:
- ``Hash ([]byte)``: The block's hash. This can be derived from the
block header.
- ``Header (struct{})``: The block header
- ``AbsentValidators ([]int32)``: List of indices of validators not
included in the LastCommit
- ``ByzantineValidators ([]Evidence)``: List of evidence of
validators that acted maliciously
- **Usage**: Signals the beginning of a new block. Called prior to any
DeliverTxs. The header is expected to at least contain the Height.
The ``AbsentValidators`` and ``ByzantineValidators`` can be used to
determine rewards and punishments for the validators.
CheckTx
^^^^^^^
- **Arguments**:
- ``Data ([]byte)``: The request transaction bytes
- **Returns**:
- ``Code (uint32)``: Response code
- ``Data ([]byte)``: Result bytes, if any
- ``Log (string)``: Debug or error message
- ``Gas (int64)``: Amount of gas consumed by transaction
- ``Fee (int64)``: Fee paid by transaction
- **Usage**: Validate a mempool transaction, prior to broadcasting or
proposing. This message should not mutate the main state, but
application developers may want to keep a separate CheckTx state that
gets reset upon Commit.
CheckTx can happen interspersed with DeliverTx, but they happen on
different ABCI connections - CheckTx from the mempool connection, and
DeliverTx from the consensus connection. During Commit, the mempool
is locked, so you can reset the mempool state to the latest state
after running all those DeliverTxs, and then the mempool will re-run
whatever txs it has against that latest mempool state.
Transactions are first run through CheckTx before broadcast to peers
in the mempool layer. You can make CheckTx semi-stateful and clear
the state upon ``Commit`` or ``BeginBlock``, to allow for dependent
sequences of transactions in the same block.
DeliverTx
^^^^^^^^^
- **Arguments**:
- ``Data ([]byte)``: The request transaction bytes
- **Returns**:
- ``Code (uint32)``: Response code
- ``Data ([]byte)``: Result bytes, if any
- ``Log (string)``: Debug or error message
- ``Tags ([]*KVPair)``: Optional tags for indexing
- **Usage**: Append and run a transaction. If the transaction is valid,
returns CodeType.OK
EndBlock
^^^^^^^^
- **Arguments**:
- ``Height (int64)``: The block height that ended
- **Returns**:
- ``ValidatorUpdates ([]Validator)``: Changes to validator set (set
voting power to 0 to remove)
- ``ConsensusParamUpdates (ConsensusParams)``: Changes to
consensus-critical time/size parameters
- **Usage**: Signals the end of a block. Called prior to each Commit
after all transactions. Validator set is updated with the result.
Commit
^^^^^^
- **Returns**:
- ``Data ([]byte)``: The Merkle root hash
- ``Log (string)``: Debug or error message
- **Usage**: Return a Merkle root hash of the application state.

+ 12
- 13
tests/server/client.go View File

@ -7,19 +7,21 @@ import (
abcicli "github.com/tendermint/abci/client"
"github.com/tendermint/abci/types"
crypto "github.com/tendermint/go-crypto"
cmn "github.com/tendermint/tmlibs/common"
)
func InitChain(client abcicli.Client) error {
total := 10
vals := make([]*types.Validator, total)
vals := make([]types.Validator, total)
for i := 0; i < total; i++ {
pubkey := crypto.GenPrivKeyEd25519FromSecret([]byte(cmn.Fmt("test%d", i))).PubKey().Bytes()
pubkey := cmn.RandBytes(33)
power := cmn.RandInt()
vals[i] = &types.Validator{pubkey, int64(power)}
vals[i] = types.Validator{pubkey, int64(power)}
}
_, err := client.InitChainSync(types.RequestInitChain{Validators: vals})
_, err := client.InitChainSync(types.RequestInitChain{
Validators: vals,
AppStateBytes: []byte("{}"),
})
if err != nil {
fmt.Printf("Failed test: InitChain - %v\n", err)
return err
@ -29,12 +31,10 @@ func InitChain(client abcicli.Client) error {
}
func SetOption(client abcicli.Client, key, value string) error {
res, err := client.SetOptionSync(types.RequestSetOption{Key: key, Value: value})
log := res.GetLog()
_, err := client.SetOptionSync(types.RequestSetOption{Key: key, Value: value})
if err != nil {
fmt.Println("Failed test: SetOption")
fmt.Printf("setting %v=%v: \nlog: %v\n", key, value, log)
fmt.Println("Failed test: SetOption")
fmt.Printf("error while setting %v=%v: \nerror: %v\n", key, value)
return err
}
fmt.Println("Passed test: SetOption")
@ -43,16 +43,15 @@ func SetOption(client abcicli.Client, key, value string) error {
func Commit(client abcicli.Client, hashExp []byte) error {
res, err := client.CommitSync()
_, data := res.Code, res.Data
data := res.Data
if err != nil {
fmt.Println("Failed test: Commit")
fmt.Printf("committing %v\nlog: %v\n", res.GetLog(), err)
fmt.Printf("error while committing: %v\n", err)
return err
}
if !bytes.Equal(data, hashExp) {
fmt.Println("Failed test: Commit")
fmt.Printf("Commit hash was unexpected. Got %X expected %X\n",
data.Bytes(), hashExp)
fmt.Printf("Commit hash was unexpected. Got %X expected %X\n", data, hashExp)
return errors.New("CommitTx failed")
}
fmt.Println("Passed test: Commit")


+ 3
- 1
tests/test.sh View File

@ -5,5 +5,7 @@ set -e
bash tests/test_app/test.sh
# test the cli against the examples in the tutorial at tendermint.com
bash tests/test_cli/test.sh
# TODO: make these less fragile
# bash tests/test_cli/test.sh

+ 0
- 3
tests/test_app/app.go View File

@ -37,9 +37,6 @@ func commit(client abcicli.Client, hashExp []byte) {
if err != nil {
panicf("client error: %v", err)
}
if res.IsErr() {
panicf("committing err %v\n", res)
}
if !bytes.Equal(res.Data, hashExp) {
panicf("Commit hash was unexpected. Got %X expected %X", res.Data, hashExp)
}


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

@ -10,29 +10,29 @@ DIR="$( cd -P "$( dirname "$SOURCE" )/../.." && pwd )"
cd "$DIR" || exit
function testExample() {
N=$1
INPUT=$2
APP="$3 $4"
echo "Example $N: $APP"
$APP &> /dev/null &
sleep 2
abci-cli --log_level=error --verbose batch < "$INPUT" > "${INPUT}.out.new"
killall "$3"
pre=$(shasum < "${INPUT}.out")
post=$(shasum < "${INPUT}.out.new")
if [[ "$pre" != "$post" ]]; then
echo "You broke the tutorial"
echo "Got:"
cat "${INPUT}.out.new"
echo "Expected:"
cat "${INPUT}.out"
exit 1
fi
rm "${INPUT}".out.new
N=$1
INPUT=$2
APP="$3 $4"
echo "Example $N: $APP"
$APP &> /dev/null &
sleep 2
abci-cli --log_level=error --verbose batch < "$INPUT" > "${INPUT}.out.new"
killall "$3"
pre=$(shasum < "${INPUT}.out")
post=$(shasum < "${INPUT}.out.new")
if [[ "$pre" != "$post" ]]; then
echo "You broke the tutorial"
echo "Got:"
cat "${INPUT}.out.new"
echo "Expected:"
cat "${INPUT}.out"
exit 1
fi
rm "${INPUT}".out.new
}
testExample 1 tests/test_cli/ex1.abci abci-cli dummy


+ 2
- 2
types/application.go View File

@ -42,7 +42,7 @@ func (BaseApplication) Info(req RequestInfo) ResponseInfo {
}
func (BaseApplication) SetOption(req RequestSetOption) ResponseSetOption {
return ResponseSetOption{Code: CodeTypeOK}
return ResponseSetOption{}
}
func (BaseApplication) DeliverTx(tx []byte) ResponseDeliverTx {
@ -54,7 +54,7 @@ func (BaseApplication) CheckTx(tx []byte) ResponseCheckTx {
}
func (BaseApplication) Commit() ResponseCommit {
return ResponseCommit{Code: CodeTypeOK}
return ResponseCommit{}
}
func (BaseApplication) Query(req RequestQuery) ResponseQuery {


+ 48
- 11
types/messages.go View File

@ -1,33 +1,70 @@
package types
import (
"bufio"
"encoding/binary"
"io"
"github.com/gogo/protobuf/proto"
wire "github.com/tendermint/go-wire"
)
// WriteMessage writes a length-delimited protobuf message.
const (
maxMsgSize = 104857600 // 100MB
)
// WriteMessage writes a varint length-delimited protobuf message.
func WriteMessage(msg proto.Message, w io.Writer) error {
bz, err := proto.Marshal(msg)
if err != nil {
return err
}
var n int
wire.WriteByteSlice(bz, w, &n, &err)
return err
return encodeByteSlice(w, bz)
}
// ReadMessage reads a length delimited protobuf message.
// ReadMessage reads a varint length-delimited protobuf message.
func ReadMessage(r io.Reader, msg proto.Message) error {
var n int
var err error
bz := wire.ReadByteSlice(r, 0, &n, &err) //XXX: no max
return readProtoMsg(r, msg, maxMsgSize)
}
func readProtoMsg(r io.Reader, msg proto.Message, maxSize int) error {
// binary.ReadVarint takes an io.ByteReader, eg. a bufio.Reader
reader, ok := r.(*bufio.Reader)
if !ok {
reader = bufio.NewReader(r)
}
length64, err := binary.ReadVarint(reader)
if err != nil {
return err
}
err = proto.Unmarshal(bz, msg)
return err
length := int(length64)
if length < 0 || length > maxSize {
return io.ErrShortBuffer
}
buf := make([]byte, length)
if _, err := io.ReadFull(reader, buf); err != nil {
return err
}
return proto.Unmarshal(buf, msg)
}
//-----------------------------------------------------------------------
// NOTE: we copied wire.EncodeByteSlice from go-wire rather than keep
// go-wire as a dep
func encodeByteSlice(w io.Writer, bz []byte) (err error) {
err = encodeVarint(w, int64(len(bz)))
if err != nil {
return
}
_, err = w.Write(bz)
return
}
func encodeVarint(w io.Writer, i int64) (err error) {
var buf [10]byte
n := binary.PutVarint(buf[:], i)
_, err = w.Write(buf[0:n])
return
}
//----------------------------------------


+ 55
- 5
types/messages_test.go View File

@ -8,18 +8,20 @@ import (
"github.com/gogo/protobuf/proto"
"github.com/stretchr/testify/assert"
cmn "github.com/tendermint/tmlibs/common"
)
func TestMarshalJSON(t *testing.T) {
b, err := json.Marshal(&ResponseDeliverTx{})
assert.Nil(t, err)
assert.True(t, strings.Contains(string(b), "code"))
// Do not include empty fields.
assert.False(t, strings.Contains(string(b), "code"))
r1 := ResponseCheckTx{
Code: 1,
Data: []byte("hello"),
Gas: 43,
Fee: 12,
Code: 1,
Data: []byte("hello"),
GasWanted: 43,
Fee: cmn.KI64Pair{[]byte("pho"), 12},
}
b, err = json.Marshal(&r1)
assert.Nil(t, err)
@ -30,6 +32,26 @@ func TestMarshalJSON(t *testing.T) {
assert.Equal(t, r1, r2)
}
func TestWriteReadMessageSimple(t *testing.T) {
cases := []proto.Message{
&RequestEcho{
Message: "Hello",
},
}
for _, c := range cases {
buf := new(bytes.Buffer)
err := WriteMessage(c, buf)
assert.Nil(t, err)
msg := new(RequestEcho)
err = ReadMessage(buf, msg)
assert.Nil(t, err)
assert.Equal(t, c, msg)
}
}
func TestWriteReadMessage(t *testing.T) {
cases := []proto.Message{
&Header{
@ -50,3 +72,31 @@ func TestWriteReadMessage(t *testing.T) {
assert.Equal(t, c, msg)
}
}
func TestWriteReadMessage2(t *testing.T) {
phrase := "hello-world"
cases := []proto.Message{
&ResponseCheckTx{
Data: []byte(phrase),
Log: phrase,
GasWanted: 10,
Tags: []cmn.KVPair{
cmn.KVPair{[]byte("abc"), []byte("def")},
},
// Fee: cmn.KI64Pair{
},
// TODO: add the rest
}
for _, c := range cases {
buf := new(bytes.Buffer)
err := WriteMessage(c, buf)
assert.Nil(t, err)
msg := new(ResponseCheckTx)
err = ReadMessage(buf, msg)
assert.Nil(t, err)
assert.Equal(t, c, msg)
}
}

+ 1
- 36
types/result.go View File

@ -3,7 +3,6 @@ package types
import (
"bytes"
"encoding/json"
"fmt"
"github.com/gogo/protobuf/jsonpb"
)
@ -22,11 +21,6 @@ func (r ResponseCheckTx) IsErr() bool {
return r.Code != CodeTypeOK
}
// Error implements error interface by formatting response as string.
func (r ResponseCheckTx) Error() string {
return fmtError(r.Code, r.Log)
}
// IsOK returns true if Code is OK.
func (r ResponseDeliverTx) IsOK() bool {
return r.Code == CodeTypeOK
@ -37,26 +31,6 @@ func (r ResponseDeliverTx) IsErr() bool {
return r.Code != CodeTypeOK
}
// Error implements error interface by formatting response as string.
func (r ResponseDeliverTx) Error() string {
return fmtError(r.Code, r.Log)
}
// IsOK returns true if Code is OK.
func (r ResponseCommit) IsOK() bool {
return r.Code == CodeTypeOK
}
// IsErr returns true if Code is something other than OK.
func (r ResponseCommit) IsErr() bool {
return r.Code != CodeTypeOK
}
// Error implements error interface by formatting response as string.
func (r ResponseCommit) Error() string {
return fmtError(r.Code, r.Log)
}
// IsOK returns true if Code is OK.
func (r ResponseQuery) IsOK() bool {
return r.Code == CodeTypeOK
@ -67,15 +41,6 @@ func (r ResponseQuery) IsErr() bool {
return r.Code != CodeTypeOK
}
// Error implements error interface by formatting response as string.
func (r ResponseQuery) Error() string {
return fmtError(r.Code, r.Log)
}
func fmtError(code uint32, log string) string {
return fmt.Sprintf("Error code (%d): %s", code, log)
}
//---------------------------------------------------------------------------
// override JSON marshalling so we dont emit defaults (ie. disable omitempty)
// note we need Unmarshal functions too because protobuf had the bright idea
@ -84,7 +49,7 @@ func fmtError(code uint32, log string) string {
var (
jsonpbMarshaller = jsonpb.Marshaler{
EnumsAsInts: true,
EmitDefaults: true,
EmitDefaults: false,
}
jsonpbUnmarshaller = jsonpb.Unmarshaler{}
)


+ 0
- 74
types/result_test.go View File

@ -1,74 +0,0 @@
package types
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestResponseQuery(t *testing.T) {
res := ResponseQuery{
Code: CodeTypeOK,
Index: 0,
Key: []byte("hello"),
Value: []byte("world"),
Height: 1,
}
assert.False(t, res.IsErr())
res = ResponseQuery{
Code: 1,
Index: 0,
Key: []byte("hello"),
Value: []byte("world"),
Height: 1,
Log: "bad",
}
assert.True(t, res.IsErr())
assert.Equal(t, "Error code (1): bad", res.Error())
}
func TestResponseDeliverTx(t *testing.T) {
res := ResponseDeliverTx{
Code: CodeTypeOK,
Data: []byte("Victor Mancha"),
}
assert.False(t, res.IsErr())
res = ResponseDeliverTx{
Code: 1,
Log: "bad",
}
assert.True(t, res.IsErr())
assert.Equal(t, "Error code (1): bad", res.Error())
}
func TestResponseCheckTx(t *testing.T) {
res := ResponseCheckTx{
Code: CodeTypeOK,
Data: []byte("Talos"),
}
assert.False(t, res.IsErr())
res = ResponseCheckTx{
Code: 1,
Log: "bad",
}
assert.True(t, res.IsErr())
assert.Equal(t, "Error code (1): bad", res.Error())
}
func TestResponseCommit(t *testing.T) {
res := ResponseCommit{
Code: CodeTypeOK,
Data: []byte("Old Lace"),
}
assert.False(t, res.IsErr())
res = ResponseCommit{
Code: 1,
Log: "bad",
}
assert.True(t, res.IsErr())
assert.Equal(t, "Error code (1): bad", res.Error())
}

+ 276
- 245
types/types.pb.go View File

@ -42,7 +42,6 @@ It has these top-level messages:
PartSetHeader
Validator
Evidence
KVPair
*/
//nolint: gas
package types
@ -51,8 +50,7 @@ import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import github_com_tendermint_go_wire_data "github.com/tendermint/go-wire/data"
import common "github.com/tendermint/tmlibs/common"
import context "golang.org/x/net/context"
import grpc "google.golang.org/grpc"
@ -68,27 +66,6 @@ var _ = math.Inf
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package
type KVPair_Type int32
const (
KVPair_STRING KVPair_Type = 0
KVPair_INT KVPair_Type = 1
)
var KVPair_Type_name = map[int32]string{
0: "STRING",
1: "INT",
}
var KVPair_Type_value = map[string]int32{
"STRING": 0,
"INT": 1,
}
func (x KVPair_Type) String() string {
return proto.EnumName(KVPair_Type_name, int32(x))
}
func (KVPair_Type) EnumDescriptor() ([]byte, []int) { return fileDescriptorTypes, []int{34, 0} }
type Request struct {
// Types that are valid to be assigned to Value:
// *Request_Echo
@ -529,6 +506,7 @@ func (m *RequestInfo) GetVersion() string {
return ""
}
// nondeterministic
type RequestSetOption struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
@ -554,7 +532,8 @@ func (m *RequestSetOption) GetValue() string {
}
type RequestInitChain struct {
Validators []*Validator `protobuf:"bytes,1,rep,name=validators" json:"validators,omitempty"`
Validators []Validator `protobuf:"bytes,1,rep,name=validators" json:"validators"`
AppStateBytes []byte `protobuf:"bytes,2,opt,name=app_state_bytes,json=appStateBytes,proto3" json:"app_state_bytes,omitempty"`
}
func (m *RequestInitChain) Reset() { *m = RequestInitChain{} }
@ -562,13 +541,20 @@ func (m *RequestInitChain) String() string { return proto.CompactText
func (*RequestInitChain) ProtoMessage() {}
func (*RequestInitChain) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{5} }
func (m *RequestInitChain) GetValidators() []*Validator {
func (m *RequestInitChain) GetValidators() []Validator {
if m != nil {
return m.Validators
}
return nil
}
func (m *RequestInitChain) GetAppStateBytes() []byte {
if m != nil {
return m.AppStateBytes
}
return nil
}
type RequestQuery struct {
Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
Path string `protobuf:"bytes,2,opt,name=path,proto3" json:"path,omitempty"`
@ -610,10 +596,10 @@ func (m *RequestQuery) GetProve() bool {
}
type RequestBeginBlock struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Header *Header `protobuf:"bytes,2,opt,name=header" json:"header,omitempty"`
AbsentValidators []int32 `protobuf:"varint,3,rep,packed,name=absent_validators,json=absentValidators" json:"absent_validators,omitempty"`
ByzantineValidators []*Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators" json:"byzantine_validators,omitempty"`
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Header Header `protobuf:"bytes,2,opt,name=header" json:"header"`
AbsentValidators []int32 `protobuf:"varint,3,rep,packed,name=absent_validators,json=absentValidators" json:"absent_validators,omitempty"`
ByzantineValidators []Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators" json:"byzantine_validators"`
}
func (m *RequestBeginBlock) Reset() { *m = RequestBeginBlock{} }
@ -628,11 +614,11 @@ func (m *RequestBeginBlock) GetHash() []byte {
return nil
}
func (m *RequestBeginBlock) GetHeader() *Header {
func (m *RequestBeginBlock) GetHeader() Header {
if m != nil {
return m.Header
}
return nil
return Header{}
}
func (m *RequestBeginBlock) GetAbsentValidators() []int32 {
@ -642,7 +628,7 @@ func (m *RequestBeginBlock) GetAbsentValidators() []int32 {
return nil
}
func (m *RequestBeginBlock) GetByzantineValidators() []*Evidence {
func (m *RequestBeginBlock) GetByzantineValidators() []Evidence {
if m != nil {
return m.ByzantineValidators
}
@ -1136,6 +1122,7 @@ func _Response_OneofSizer(msg proto.Message) (n int) {
return n
}
// nondeterministic
type ResponseException struct {
Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
}
@ -1216,9 +1203,12 @@ func (m *ResponseInfo) GetLastBlockAppHash() []byte {
return nil
}
// nondeterministic
type ResponseSetOption struct {
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Log string `protobuf:"bytes,2,opt,name=log,proto3" json:"log,omitempty"`
// bytes data = 2;
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
}
func (m *ResponseSetOption) Reset() { *m = ResponseSetOption{} }
@ -1240,6 +1230,13 @@ func (m *ResponseSetOption) GetLog() string {
return ""
}
func (m *ResponseSetOption) GetInfo() string {
if m != nil {
return m.Info
}
return ""
}
type ResponseInitChain struct {
}
@ -1249,13 +1246,15 @@ func (*ResponseInitChain) ProtoMessage() {}
func (*ResponseInitChain) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{18} }
type ResponseQuery struct {
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Index int64 `protobuf:"varint,2,opt,name=index,proto3" json:"index,omitempty"`
Key github_com_tendermint_go_wire_data.Bytes `protobuf:"bytes,3,opt,name=key,proto3,customtype=github.com/tendermint/go-wire/data.Bytes" json:"key"`
Value github_com_tendermint_go_wire_data.Bytes `protobuf:"bytes,4,opt,name=value,proto3,customtype=github.com/tendermint/go-wire/data.Bytes" json:"value"`
Proof github_com_tendermint_go_wire_data.Bytes `protobuf:"bytes,5,opt,name=proof,proto3,customtype=github.com/tendermint/go-wire/data.Bytes" json:"proof"`
Height int64 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"`
Log string `protobuf:"bytes,7,opt,name=log,proto3" json:"log,omitempty"`
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
// bytes data = 2; // use "value" instead.
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
Index int64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
Key []byte `protobuf:"bytes,6,opt,name=key,proto3" json:"key,omitempty"`
Value []byte `protobuf:"bytes,7,opt,name=value,proto3" json:"value,omitempty"`
Proof []byte `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"`
Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"`
}
func (m *ResponseQuery) Reset() { *m = ResponseQuery{} }
@ -1270,6 +1269,20 @@ func (m *ResponseQuery) GetCode() uint32 {
return 0
}
func (m *ResponseQuery) GetLog() string {
if m != nil {
return m.Log
}
return ""
}
func (m *ResponseQuery) GetInfo() string {
if m != nil {
return m.Info
}
return ""
}
func (m *ResponseQuery) GetIndex() int64 {
if m != nil {
return m.Index
@ -1277,18 +1290,32 @@ func (m *ResponseQuery) GetIndex() int64 {
return 0
}
func (m *ResponseQuery) GetHeight() int64 {
func (m *ResponseQuery) GetKey() []byte {
if m != nil {
return m.Height
return m.Key
}
return 0
return nil
}
func (m *ResponseQuery) GetLog() string {
func (m *ResponseQuery) GetValue() []byte {
if m != nil {
return m.Log
return m.Value
}
return ""
return nil
}
func (m *ResponseQuery) GetProof() []byte {
if m != nil {
return m.Proof
}
return nil
}
func (m *ResponseQuery) GetHeight() int64 {
if m != nil {
return m.Height
}
return 0
}
type ResponseBeginBlock struct {
@ -1300,11 +1327,14 @@ func (*ResponseBeginBlock) ProtoMessage() {}
func (*ResponseBeginBlock) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{20} }
type ResponseCheckTx struct {
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Data github_com_tendermint_go_wire_data.Bytes `protobuf:"bytes,2,opt,name=data,proto3,customtype=github.com/tendermint/go-wire/data.Bytes" json:"data"`
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Gas int64 `protobuf:"varint,4,opt,name=gas,proto3" json:"gas,omitempty"`
Fee int64 `protobuf:"varint,5,opt,name=fee,proto3" json:"fee,omitempty"`
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"`
// int64 gas_used = 6;
Tags []common.KVPair `protobuf:"bytes,7,rep,name=tags" json:"tags,omitempty"`
Fee common.KI64Pair `protobuf:"bytes,8,opt,name=fee" json:"fee"`
}
func (m *ResponseCheckTx) Reset() { *m = ResponseCheckTx{} }
@ -1319,6 +1349,13 @@ func (m *ResponseCheckTx) GetCode() uint32 {
return 0
}
func (m *ResponseCheckTx) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}
func (m *ResponseCheckTx) GetLog() string {
if m != nil {
return m.Log
@ -1326,25 +1363,42 @@ func (m *ResponseCheckTx) GetLog() string {
return ""
}
func (m *ResponseCheckTx) GetGas() int64 {
func (m *ResponseCheckTx) GetInfo() string {
if m != nil {
return m.Info
}
return ""
}
func (m *ResponseCheckTx) GetGasWanted() int64 {
if m != nil {
return m.Gas
return m.GasWanted
}
return 0
}
func (m *ResponseCheckTx) GetFee() int64 {
func (m *ResponseCheckTx) GetTags() []common.KVPair {
if m != nil {
return m.Tags
}
return nil
}
func (m *ResponseCheckTx) GetFee() common.KI64Pair {
if m != nil {
return m.Fee
}
return 0
return common.KI64Pair{}
}
type ResponseDeliverTx struct {
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Data github_com_tendermint_go_wire_data.Bytes `protobuf:"bytes,2,opt,name=data,proto3,customtype=github.com/tendermint/go-wire/data.Bytes" json:"data"`
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Tags []*KVPair `protobuf:"bytes,4,rep,name=tags" json:"tags,omitempty"`
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
Info string `protobuf:"bytes,4,opt,name=info,proto3" json:"info,omitempty"`
GasWanted int64 `protobuf:"varint,5,opt,name=gas_wanted,json=gasWanted,proto3" json:"gas_wanted,omitempty"`
GasUsed int64 `protobuf:"varint,6,opt,name=gas_used,json=gasUsed,proto3" json:"gas_used,omitempty"`
Tags []common.KVPair `protobuf:"bytes,7,rep,name=tags" json:"tags,omitempty"`
}
func (m *ResponseDeliverTx) Reset() { *m = ResponseDeliverTx{} }
@ -1359,6 +1413,13 @@ func (m *ResponseDeliverTx) GetCode() uint32 {
return 0
}
func (m *ResponseDeliverTx) GetData() []byte {
if m != nil {
return m.Data
}
return nil
}
func (m *ResponseDeliverTx) GetLog() string {
if m != nil {
return m.Log
@ -1366,7 +1427,28 @@ func (m *ResponseDeliverTx) GetLog() string {
return ""
}
func (m *ResponseDeliverTx) GetTags() []*KVPair {
func (m *ResponseDeliverTx) GetInfo() string {
if m != nil {
return m.Info
}
return ""
}
func (m *ResponseDeliverTx) GetGasWanted() int64 {
if m != nil {
return m.GasWanted
}
return 0
}
func (m *ResponseDeliverTx) GetGasUsed() int64 {
if m != nil {
return m.GasUsed
}
return 0
}
func (m *ResponseDeliverTx) GetTags() []common.KVPair {
if m != nil {
return m.Tags
}
@ -1374,7 +1456,7 @@ func (m *ResponseDeliverTx) GetTags() []*KVPair {
}
type ResponseEndBlock struct {
ValidatorUpdates []*Validator `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates" json:"validator_updates,omitempty"`
ValidatorUpdates []Validator `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates" json:"validator_updates"`
ConsensusParamUpdates *ConsensusParams `protobuf:"bytes,2,opt,name=consensus_param_updates,json=consensusParamUpdates" json:"consensus_param_updates,omitempty"`
}
@ -1383,7 +1465,7 @@ func (m *ResponseEndBlock) String() string { return proto.CompactText
func (*ResponseEndBlock) ProtoMessage() {}
func (*ResponseEndBlock) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{23} }
func (m *ResponseEndBlock) GetValidatorUpdates() []*Validator {
func (m *ResponseEndBlock) GetValidatorUpdates() []Validator {
if m != nil {
return m.ValidatorUpdates
}
@ -1398,9 +1480,8 @@ func (m *ResponseEndBlock) GetConsensusParamUpdates() *ConsensusParams {
}
type ResponseCommit struct {
Code uint32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"`
Data github_com_tendermint_go_wire_data.Bytes `protobuf:"bytes,2,opt,name=data,proto3,customtype=github.com/tendermint/go-wire/data.Bytes" json:"data"`
Log string `protobuf:"bytes,3,opt,name=log,proto3" json:"log,omitempty"`
// reserve 1
Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"`
}
func (m *ResponseCommit) Reset() { *m = ResponseCommit{} }
@ -1408,18 +1489,11 @@ func (m *ResponseCommit) String() string { return proto.CompactTextSt
func (*ResponseCommit) ProtoMessage() {}
func (*ResponseCommit) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{24} }
func (m *ResponseCommit) GetCode() uint32 {
if m != nil {
return m.Code
}
return 0
}
func (m *ResponseCommit) GetLog() string {
func (m *ResponseCommit) GetData() []byte {
if m != nil {
return m.Log
return m.Data
}
return ""
return nil
}
// ConsensusParams contains all consensus-relevant parameters
@ -1534,15 +1608,15 @@ func (m *BlockGossip) GetBlockPartSizeBytes() int32 {
}
type Header struct {
ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
Time int64 `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"`
NumTxs int32 `protobuf:"varint,4,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"`
LastBlockID *BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId" json:"last_block_id,omitempty"`
LastCommitHash []byte `protobuf:"bytes,6,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"`
DataHash []byte `protobuf:"bytes,7,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"`
ValidatorsHash []byte `protobuf:"bytes,8,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"`
AppHash []byte `protobuf:"bytes,9,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"`
ChainID string `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
Height int64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
Time int64 `protobuf:"varint,3,opt,name=time,proto3" json:"time,omitempty"`
NumTxs int32 `protobuf:"varint,4,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"`
LastBlockID BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId" json:"last_block_id"`
LastCommitHash []byte `protobuf:"bytes,6,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"`
DataHash []byte `protobuf:"bytes,7,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,omitempty"`
ValidatorsHash []byte `protobuf:"bytes,8,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"`
AppHash []byte `protobuf:"bytes,9,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"`
}
func (m *Header) Reset() { *m = Header{} }
@ -1578,11 +1652,11 @@ func (m *Header) GetNumTxs() int32 {
return 0
}
func (m *Header) GetLastBlockID() *BlockID {
func (m *Header) GetLastBlockID() BlockID {
if m != nil {
return m.LastBlockID
}
return nil
return BlockID{}
}
func (m *Header) GetLastCommitHash() []byte {
@ -1614,8 +1688,8 @@ func (m *Header) GetAppHash() []byte {
}
type BlockID struct {
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Parts *PartSetHeader `protobuf:"bytes,2,opt,name=parts" json:"parts,omitempty"`
Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
Parts PartSetHeader `protobuf:"bytes,2,opt,name=parts" json:"parts"`
}
func (m *BlockID) Reset() { *m = BlockID{} }
@ -1630,11 +1704,11 @@ func (m *BlockID) GetHash() []byte {
return nil
}
func (m *BlockID) GetParts() *PartSetHeader {
func (m *BlockID) GetParts() PartSetHeader {
if m != nil {
return m.Parts
}
return nil
return PartSetHeader{}
}
type PartSetHeader struct {
@ -1709,46 +1783,6 @@ func (m *Evidence) GetHeight() int64 {
return 0
}
type KVPair struct {
Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
ValueType KVPair_Type `protobuf:"varint,2,opt,name=value_type,json=valueType,proto3,enum=types.KVPair_Type" json:"value_type,omitempty"`
ValueString string `protobuf:"bytes,3,opt,name=value_string,json=valueString,proto3" json:"value_string,omitempty"`
ValueInt int64 `protobuf:"varint,4,opt,name=value_int,json=valueInt,proto3" json:"value_int,omitempty"`
}
func (m *KVPair) Reset() { *m = KVPair{} }
func (m *KVPair) String() string { return proto.CompactTextString(m) }
func (*KVPair) ProtoMessage() {}
func (*KVPair) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{34} }
func (m *KVPair) GetKey() string {
if m != nil {
return m.Key
}
return ""
}
func (m *KVPair) GetValueType() KVPair_Type {
if m != nil {
return m.ValueType
}
return KVPair_STRING
}
func (m *KVPair) GetValueString() string {
if m != nil {
return m.ValueString
}
return ""
}
func (m *KVPair) GetValueInt() int64 {
if m != nil {
return m.ValueInt
}
return 0
}
func init() {
proto.RegisterType((*Request)(nil), "types.Request")
proto.RegisterType((*RequestEcho)(nil), "types.RequestEcho")
@ -1784,8 +1818,6 @@ func init() {
proto.RegisterType((*PartSetHeader)(nil), "types.PartSetHeader")
proto.RegisterType((*Validator)(nil), "types.Validator")
proto.RegisterType((*Evidence)(nil), "types.Evidence")
proto.RegisterType((*KVPair)(nil), "types.KVPair")
proto.RegisterEnum("types.KVPair_Type", KVPair_Type_name, KVPair_Type_value)
}
// Reference imports to suppress errors if they are not otherwise used.
@ -2193,116 +2225,115 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{
func init() { proto.RegisterFile("types/types.proto", fileDescriptorTypes) }
var fileDescriptorTypes = []byte{
// 1766 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x72, 0x1b, 0xc7,
0x11, 0x26, 0xfe, 0xb1, 0x0d, 0xfe, 0x80, 0x43, 0x4a, 0x82, 0xa1, 0x83, 0xe8, 0xad, 0x8a, 0x0d,
0xd9, 0x16, 0x69, 0xd3, 0xa5, 0x94, 0x68, 0x27, 0xae, 0x08, 0xa4, 0x2c, 0xa2, 0x9c, 0x52, 0x94,
0x15, 0xe3, 0x43, 0x2e, 0xa8, 0x01, 0x76, 0x08, 0x6c, 0x09, 0xd8, 0x5d, 0xef, 0x0e, 0x68, 0x50,
0x95, 0x47, 0xf0, 0x3d, 0xe7, 0xe4, 0x98, 0x17, 0xc8, 0x31, 0xa7, 0xa4, 0xf2, 0x0c, 0x39, 0xe8,
0xe0, 0x27, 0x49, 0x75, 0xcf, 0xec, 0x2f, 0x76, 0x53, 0x29, 0x1d, 0x74, 0x01, 0x66, 0xa6, 0x7f,
0xb6, 0xbb, 0xa7, 0xe7, 0xeb, 0x9e, 0x81, 0x7d, 0x79, 0xeb, 0x8b, 0xf0, 0x84, 0x7e, 0x8f, 0xfd,
0xc0, 0x93, 0x1e, 0x6b, 0xd0, 0xa4, 0xff, 0x68, 0xe6, 0xc8, 0xf9, 0x6a, 0x72, 0x3c, 0xf5, 0x96,
0x27, 0x33, 0x6f, 0xe6, 0x9d, 0x10, 0x75, 0xb2, 0xba, 0xa6, 0x19, 0x4d, 0x68, 0xa4, 0xa4, 0xcc,
0x7f, 0xd5, 0xa1, 0x65, 0x89, 0x1f, 0x56, 0x22, 0x94, 0x6c, 0x00, 0x75, 0x31, 0x9d, 0x7b, 0xbd,
0xea, 0x51, 0x65, 0xd0, 0x39, 0x65, 0xc7, 0x4a, 0xbb, 0xa6, 0x3e, 0x9b, 0xce, 0xbd, 0xcb, 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, 0xfa, 0x9f, 0xbc, 0x00, 0x48, 0x7d, 0x7b, 0x96, 0xbe, 0x87, 0x0c, 0xca, 0xeb, 0x7a, 0x82,
0xe1, 0x18, 0x7f, 0xab, 0x15, 0xbf, 0x53, 0x0c, 0xca, 0x4a, 0xed, 0x79, 0x53, 0xbe, 0x65, 0x7d,
0xfa, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x11, 0xd7, 0x9f, 0xcd, 0x47, 0x13, 0x00, 0x00,
}

+ 44
- 41
types/types.proto View File

@ -4,8 +4,11 @@ package types;
// For more information on gogo.proto, see:
// https://github.com/gogo/protobuf/blob/master/extensions.md
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "github.com/tendermint/tmlibs/common/types.proto";
// This file is copied from http://github.com/tendermint/abci
// NOTE: When using custom types, mind the warnings.
// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues
//----------------------------------------
// Request types
@ -37,16 +40,18 @@ message RequestInfo {
string version = 1;
}
// nondeterministic
message RequestSetOption {
string key = 1;
string value = 2;
}
message RequestInitChain {
repeated Validator validators = 1;
repeated Validator validators = 1 [(gogoproto.nullable)=false];
bytes app_state_bytes = 2;
}
message RequestQuery{
message RequestQuery {
bytes data = 1;
string path = 2;
int64 height = 3;
@ -55,9 +60,9 @@ message RequestQuery{
message RequestBeginBlock {
bytes hash = 1;
Header header = 2;
Header header = 2 [(gogoproto.nullable)=false];
repeated int32 absent_validators = 3;
repeated Evidence byzantine_validators = 4;
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable)=false];
}
message RequestCheckTx {
@ -68,7 +73,7 @@ message RequestDeliverTx {
bytes tx = 1;
}
message RequestEndBlock{
message RequestEndBlock {
int64 height = 1;
}
@ -95,6 +100,7 @@ message Response {
}
}
// nondeterministic
message ResponseException {
string error = 1;
}
@ -113,9 +119,12 @@ message ResponseInfo {
bytes last_block_app_hash = 4;
}
// nondeterministic
message ResponseSetOption {
uint32 code = 1;
string log = 2;
// bytes data = 2;
string log = 3;
string info = 4;
}
message ResponseInitChain {
@ -123,12 +132,14 @@ message ResponseInitChain {
message ResponseQuery {
uint32 code = 1;
int64 index = 2;
bytes key = 3 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
bytes value = 4 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
bytes proof = 5 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
int64 height = 6;
string log = 7;
// bytes data = 2; // use "value" instead.
string log = 3; // nondeterministic
string info = 4; // nondeterministic
int64 index = 5;
bytes key = 6;
bytes value = 7;
bytes proof = 8;
int64 height = 9;
}
message ResponseBeginBlock {
@ -136,28 +147,34 @@ message ResponseBeginBlock {
message ResponseCheckTx {
uint32 code = 1;
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
string log = 3;
int64 gas = 4;
int64 fee = 5;
bytes data = 2;
string log = 3; // nondeterministic
string info = 4; // nondeterministic
int64 gas_wanted = 5;
// int64 gas_used = 6;
repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
common.KI64Pair fee = 8 [(gogoproto.nullable)=false];
}
message ResponseDeliverTx {
uint32 code = 1;
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
string log = 3;
repeated KVPair tags = 4;
bytes data = 2;
string log = 3; // nondeterministic
string info = 4; // nondeterministic
int64 gas_wanted = 5;
int64 gas_used = 6;
repeated common.KVPair tags = 7 [(gogoproto.nullable)=false, (gogoproto.jsontag)="tags,omitempty"];
// common.KI64Pair fee = 8;
}
message ResponseEndBlock {
repeated Validator validator_updates = 1;
repeated Validator validator_updates = 1 [(gogoproto.nullable)=false];
ConsensusParams consensus_param_updates = 2;
}
message ResponseCommit {
uint32 code = 1;
bytes data = 2 [(gogoproto.customtype) = "github.com/tendermint/go-wire/data.Bytes", (gogoproto.nullable) = false];
string log = 3;
// reserve 1
bytes data = 2;
}
//----------------------------------------
@ -179,7 +196,7 @@ message BlockSize {
}
// TxSize contain limits on the tx size.
message TxSize{
message TxSize {
int32 max_bytes = 1;
int64 max_gas = 2;
}
@ -195,11 +212,11 @@ message BlockGossip {
// Blockchain Types
message Header {
string chain_id = 1 [(gogoproto.customname) = "ChainID"];
string chain_id = 1 [(gogoproto.customname)="ChainID"];
int64 height = 2;
int64 time = 3;
int32 num_txs = 4;
BlockID last_block_id = 5 [(gogoproto.customname) = "LastBlockID"];
BlockID last_block_id = 5 [(gogoproto.customname)="LastBlockID", (gogoproto.nullable)=false];
bytes last_commit_hash = 6;
bytes data_hash = 7;
bytes validators_hash = 8;
@ -208,7 +225,7 @@ message Header {
message BlockID {
bytes hash = 1;
PartSetHeader parts = 2;
PartSetHeader parts = 2 [(gogoproto.nullable)=false];
}
message PartSetHeader {
@ -226,20 +243,6 @@ message Evidence {
int64 height = 2;
}
//----------------------------------------
// Abstract types
message KVPair {
string key = 1;
enum Type {
STRING = 0;
INT = 1;
}
Type value_type = 2;
string value_string = 3;
int64 value_int = 4;
}
//----------------------------------------
// Service Definition


+ 5
- 28
types/util.go View File

@ -3,15 +3,12 @@ package types
import (
"bytes"
"encoding/json"
"github.com/tendermint/go-wire/data"
cmn "github.com/tendermint/tmlibs/common"
)
//------------------------------------------------------------------------------
// Validators is a list of validators that implements the Sort interface
type Validators []*Validator
type Validators []Validator
func (v Validators) Len() int {
return len(v)
@ -31,36 +28,16 @@ func (v Validators) Swap(i, j int) {
func ValidatorsString(vs Validators) string {
s := make([]validatorPretty, len(vs))
for i, v := range vs {
s[i] = validatorPretty{v.PubKey, v.Power}
s[i] = validatorPretty(v)
}
b, err := json.Marshal(s)
if err != nil {
cmn.PanicSanity(err.Error())
panic(err.Error())
}
return string(b)
}
type validatorPretty struct {
PubKey data.Bytes `json:"pub_key"`
Power int64 `json:"power"`
}
//------------------------------------------------------------------------------
// KVPairInt is a helper method to build KV pair with an integer value.
func KVPairInt(key string, val int64) *KVPair {
return &KVPair{
Key: key,
ValueInt: val,
ValueType: KVPair_INT,
}
}
// KVPairString is a helper method to build KV pair with a string value.
func KVPairString(key, val string) *KVPair {
return &KVPair{
Key: key,
ValueString: val,
ValueType: KVPair_STRING,
}
PubKey []byte `json:"pub_key"`
Power int64 `json:"power"`
}

+ 0
- 15
types/util_test.go View File

@ -1,15 +0,0 @@
package types
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestKVPairInt(t *testing.T) {
assert.Equal(t, KVPairInt("a", 1), &KVPair{Key: "a", ValueType: KVPair_INT, ValueInt: 1})
}
func TestKVPairString(t *testing.T) {
assert.Equal(t, KVPairString("a", "b"), &KVPair{Key: "a", ValueType: KVPair_STRING, ValueString: "b"})
}

+ 2
- 2
version/version.go View File

@ -3,7 +3,7 @@ package version
// NOTE: we should probably be versioning the ABCI and the abci-cli separately
const Maj = "0"
const Min = "9"
const Min = "10"
const Fix = "0"
const Version = "0.9.0"
const Version = "0.10.0"

Loading…
Cancel
Save