404
Looks like we've got some broken links.Take me home.
diff --git a/.circleci/config.yml b/.circleci/config.yml index babba409d..72e5dfa43 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -11,7 +11,7 @@ executors: machine: true docs: docker: - - image: tendermintdev/jq_curl + - image: tendermintdev/docker-website-deployment environment: AWS_REGION: us-east-1 @@ -80,7 +80,7 @@ jobs: script_path: abci/tests/test_app/test.sh # if this test fails, fix it and update the docs at: - # https://github.com/tendermint/tendermint/blob/develop/docs/abci-cli.md + # https://github.com/tendermint/tendermint/blob/master/docs/abci-cli.md test_abci_cli: executor: golang steps: @@ -191,30 +191,13 @@ jobs: deploy_docs: executor: docs steps: - - restore_cache: - name: "Restore source code cache" - keys: - - go-src-v1-{{ .Revision }} - checkout - run: - name: Trigger website build - command: | - curl --silent \ - --show-error \ - -X POST \ - --header "Content-Type: application/json" \ - -d "{\"branch\": \"$CIRCLE_BRANCH\"}" \ - "https://circleci.com/api/v1.1/project/github/$CIRCLE_PROJECT_USERNAME/$WEBSITE_REPO_NAME/build?circle-token=$TENDERBOT_API_TOKEN" > response.json - - RESULT=`jq -r '.status' response.json` - MESSAGE=`jq -r '.message' response.json` - - if [[ ${RESULT} == "null" ]] || [[ ${RESULT} -ne "200" ]]; then - echo "CircleCI API call failed: $MESSAGE" - exit 1 - else - echo "Website build started" - fi + name: "Build docs" + command: make build-docs + - run: + name: "Sync to S3" + command: make sync-docs prepare_build: executor: golang @@ -314,10 +297,6 @@ jobs: machine: image: ubuntu-1604:201903-01 steps: - - restore_cache: - name: "Restore source code cache" - keys: - - go-src-v1-{{ .Revision }} - checkout - attach_workspace: at: /tmp/workspace @@ -337,10 +316,6 @@ jobs: steps: - attach_workspace: at: /tmp/workspace - - restore_cache: - name: "Restore source code cache" - keys: - - go-src-v1-{{ .Revision }} - checkout - setup_remote_docker: docker_layer_caching: true @@ -398,10 +373,20 @@ workflows: test-suite: jobs: - deploy_docs: + context: tendermint-docs filters: branches: only: - master + tags: + only: + - /^v.*/ + - deploy_docs: + context: tendermint-docs-staging + filters: + branches: + only: + - docs-theme-latest - setup_dependencies - test_abci_apps: requires: @@ -457,3 +442,4 @@ workflows: branches: only: - /v[0-9]+\.[0-9]+/ + - master diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index df77531cc..2b513b158 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1,7 +1,7 @@ # CODEOWNERS: https://help.github.com/articles/about-codeowners/ -# Everything goes through Bucky, Anton, Alex. For now. -* @ebuchman @melekes @xla +# Everything goes through Bucky, Anton, Tess. For now. +* @ebuchman @melekes @tessr # Precious documentation /docs/README.md @zramsay diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 000000000..63c6e0f1f --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,47 @@ +# Configuration for probot-stale - https://github.com/probot/stale + +# Number of days of inactivity before an Issue or Pull Request becomes stale +daysUntilStale: 60 + +# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. +# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. +daysUntilClose: 9 + +# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) +onlyLabels: [] + +# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable +exemptLabels: + - major-release + +# Set to true to ignore issues in a project (defaults to false) +exemptProjects: true + +# Set to true to ignore issues in a milestone (defaults to false) +exemptMilestones: true + +# Set to true to ignore issues with an assignee (defaults to false) +exemptAssignees: false + +# Label to use when marking as stale +staleLabel: stale + +# Comment to post when marking as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. + +# Limit the number of actions per hour, from 1-30. Default is 30 +limitPerRun: 30 + +Limit to only `issues` or `pulls` +only: pulls + +Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': +pulls: + daysUntilStale: 30 + markComment: > + This pull request has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. \ No newline at end of file diff --git a/.gitignore b/.gitignore index 9e2e5a9ea..dfca4da95 100644 --- a/.gitignore +++ b/.gitignore @@ -15,6 +15,7 @@ test/logs coverage.txt docs/_build docs/dist +docs/.vuepress/dist *.log abci-cli docs/node_modules/ diff --git a/.golangci.yml b/.golangci.yml index 8b7fbd7ec..4da1cbadb 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,20 +1,58 @@ -run: - deadline: 1m - linters: - enable-all: true - disable: - - gocyclo - - golint - - maligned - - errcheck + enable: + - bodyclose + - deadcode + - depguard + - dogsled + - dupl + # - errcheck + # - funlen + # - gochecknoglobals + # - gochecknoinits + - goconst + - gocritic + # - gocyclo + # - godox + - gofmt + - goimports + # - golint + - gosec + - gosimple + - govet + - ineffassign - interfacer - - unparam - lll - - gochecknoglobals - - gochecknoinits - - stylecheck -# linters-settings: + - misspell + - maligned + - nakedret + - prealloc + - scopelint + - staticcheck + - structcheck + # - stylecheck + - typecheck + - unconvert + # - unparam + - unused + - varcheck + # - whitespace + # - wsl + # - gocognit + disable: + - errcheck + +issues: + exclude-rules: + - linters: + - lll + source: "https://" + +linters-settings: + dogsled: + max-blank-identifiers: 3 + maligned: + # print struct with more effective memory layout or not, false by default + suggest-new: true # govet: # check-shadowing: true # golint: diff --git a/CHANGELOG.md b/CHANGELOG.md index f835811d3..b081b2927 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,106 @@ # Changelog +## v0.32.7 + +*October 18, 2019* + +This security release fixes a vulnerability found in the `consensus` package, +where an attacker could construct a `BlockPartMessage` message in such a way +that it will lead to consensus failure. A few similar issues have been +identified and fixed here. + +**All clients are recommended to upgrade** + +Special thanks to [elvishacker](https://hackerone.com/elvishacker) for finding +and reporting this. + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### BREAKING CHANGES: + +- Go API + - [consensus] Modify `WAL#Write` and `WAL#WriteSync` to return an error if + they fail to write a message + +### SECURITY: + +- [consensus] Validate incoming messages more throughly + +## v0.32.6 + +*October 8, 2019* + +The previous patch was insufficient because the attacker could still find a way +to submit a `nil` pubkey by constructing a `PubKeyMultisigThreshold` pubkey +with `nil` subpubkeys for example. + +This release provides multiple fixes, which include recovering from panics when +accepting new peers and only allowing `ed25519` pubkeys. + +**All clients are recommended to upgrade** + +Special thanks to [fudongbai](https://hackerone.com/fudongbai) for pointing +this out. + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### SECURITY: + +- [p2p] [\#4030](https://github.com/tendermint/tendermint/issues/4030) Only allow ed25519 pubkeys when connecting + +## v0.32.5 + +*October 1, 2019* + +This release fixes a major security vulnerability found in the `p2p` package. +All clients are recommended to upgrade. See +[\#4030](https://github.com/tendermint/tendermint/issues/4030) for details. + +Special thanks to [fudongbai](https://hackerone.com/fudongbai) for discovering +and reporting this issue. + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### SECURITY: + +- [p2p] [\#4030](https://github.com/tendermint/tendermint/issues/4030) Fix for panic on nil public key send to a peer + +## v0.32.4 + +*September 19, 2019* + +Special thanks to external contributors on this release: @jon-certik, @gracenoah, @PSalant726, @gchaincl + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### BREAKING CHANGES: + +- CLI/RPC/Config + - [rpc] [\#3984](https://github.com/tendermint/tendermint/issues/3984) Add `MempoolClient` interface to `Client` interface + +### IMPROVEMENTS: + +- [rpc] [\#2010](https://github.com/tendermint/tendermint/issues/2010) Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) +- [rpc] [\#3882](https://github.com/tendermint/tendermint/issues/3882) Add custom marshalers to proto messages to disable `omitempty` +- [deps] [\#3952](https://github.com/tendermint/tendermint/pull/3952) bump github.com/go-kit/kit from 0.6.0 to 0.9.0 +- [deps] [\#3951](https://github.com/tendermint/tendermint/pull/3951) bump github.com/stretchr/testify from 1.3.0 to 1.4.0 +- [deps] [\#3945](https://github.com/tendermint/tendermint/pull/3945) bump github.com/gorilla/websocket from 1.2.0 to 1.4.1 +- [deps] [\#3948](https://github.com/tendermint/tendermint/pull/3948) bump github.com/libp2p/go-buffer-pool from 0.0.1 to 0.0.2 +- [deps] [\#3943](https://github.com/tendermint/tendermint/pull/3943) bump github.com/fortytw2/leaktest from 1.2.0 to 1.3.0 +- [deps] [\#3939](https://github.com/tendermint/tendermint/pull/3939) bump github.com/rs/cors from 1.6.0 to 1.7.0 +- [deps] [\#3937](https://github.com/tendermint/tendermint/pull/3937) bump github.com/magiconair/properties from 1.8.0 to 1.8.1 +- [deps] [\#3947](https://github.com/tendermint/tendermint/pull/3947) update gogo/protobuf version from v1.2.1 to v1.3.0 +- [deps] [\#4001](https://github.com/tendermint/tendermint/pull/4001) bump github.com/tendermint/tm-db from 0.1.1 to 0.2.0 + +### BUG FIXES: + +- [consensus] [\#3908](https://github.com/tendermint/tendermint/issues/3908) Wait `timeout_commit` to pass even if `create_empty_blocks` is `false` +- [mempool] [\#3968](https://github.com/tendermint/tendermint/issues/3968) Fix memory loading error on 32-bit machines (@jon-certik) + ## v0.32.3 *August 28, 2019* @@ -172,6 +273,93 @@ program](https://hackerone.com/tendermint). - [node] [\#3716](https://github.com/tendermint/tendermint/issues/3716) Fix a bug where `nil` is recorded as node's address - [node] [\#3741](https://github.com/tendermint/tendermint/issues/3741) Fix profiler blocking the entire node +## v0.31.11 + +*October 18, 2019* + +This security release fixes a vulnerability found in the `consensus` package, +where an attacker could construct a `BlockPartMessage` message in such a way +that it will lead to consensus failure. A few similar issues have been +identified and fixed here. + +**All clients are recommended to upgrade** + +Special thanks to [elvishacker](https://hackerone.com/elvishacker) for finding +and reporting this. + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### BREAKING CHANGES: + +- Go API + - [consensus] Modify `WAL#Write` and `WAL#WriteSync` to return an error if + they fail to write a message + +### SECURITY: + +- [consensus] Validate incoming messages more throughly + +## v0.31.10 + +*October 8, 2019* + +The previous patch was insufficient because the attacker could still find a way +to submit a `nil` pubkey by constructing a `PubKeyMultisigThreshold` pubkey +with `nil` subpubkeys for example. + +This release provides multiple fixes, which include recovering from panics when +accepting new peers and only allowing `ed25519` pubkeys. + +**All clients are recommended to upgrade** + +Special thanks to [fudongbai](https://hackerone.com/fudongbai) for pointing +this out. + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### SECURITY: + +- [p2p] [\#4030](https://github.com/tendermint/tendermint/issues/4030) Only allow ed25519 pubkeys when connecting + +## v0.31.9 + +*October 1, 2019* + +This release fixes a major security vulnerability found in the `p2p` package. +All clients are recommended to upgrade. See +[\#4030](https://github.com/tendermint/tendermint/issues/4030) for details. + +Special thanks to [fudongbai](https://hackerone.com/fudongbai) for discovering +and reporting this issue. + +Friendly reminder, we have a [bug bounty +program](https://hackerone.com/tendermint). + +### SECURITY: + +- [p2p] [\#4030](https://github.com/tendermint/tendermint/issues/4030) Fix for panic on nil public key send to a peer + +### BUG FIXES: + +- [node] [\#3716](https://github.com/tendermint/tendermint/issues/3716) Fix a bug where `nil` is recorded as node's address +- [node] [\#3741](https://github.com/tendermint/tendermint/issues/3741) Fix profiler blocking the entire node + +## v0.31.8 + +*July 29, 2019* + +This releases fixes one bug in the PEX reactor and adds a `recover` to the Go's +ABCI server, which allows it to properly cleanup. + +### IMPROVEMENTS: +- [abci] [\#3809](https://github.com/tendermint/tendermint/issues/3809) Recover from application panics in `server/socket_server.go` to allow socket cleanup (@ruseinov) + +### BUG FIXES: +- [p2p] [\#3338](https://github.com/tendermint/tendermint/issues/3338) Prevent "sent next PEX request too soon" errors by not calling + ensurePeers outside of ensurePeersRoutine + ## v0.31.7 *June 3, 2019* @@ -2465,7 +2653,7 @@ BUG FIXES: Strict versioning only began with the release of v0.7.0, in late summer 2016. The project itself began in early summer 2014 and was workable decentralized cryptocurrency software by the end of that year. -Through the course of 2015, in collaboration with Eris Industries (now Monax Indsutries), +Through the course of 2015, in collaboration with Eris Industries (now Monax Industries), many additional features were integrated, including an implementation from scratch of the Ethereum Virtual Machine. That implementation now forms the heart of [Burrow](https://github.com/hyperledger/burrow). In the later half of 2015, the consensus algorithm was upgraded with a more asynchronous design and a more deterministic and robust implementation. diff --git a/CHANGELOG_PENDING.md b/CHANGELOG_PENDING.md index d48d802b4..d54a62a21 100644 --- a/CHANGELOG_PENDING.md +++ b/CHANGELOG_PENDING.md @@ -1,8 +1,9 @@ -## v0.32.4 +## v0.32.8 \*\* Special thanks to external contributors on this release: +@erikgrinaker Friendly reminder, we have a [bug bounty program](https://hackerone.com/tendermint). @@ -11,20 +12,53 @@ program](https://hackerone.com/tendermint). - CLI/RPC/Config - [rpc] \#3471 Paginate `/validator` response, default returns all validators with no limit + - [rpc] \#3188 Remove `BlockMeta` in `ResultBlock` in favor of `BlockId` for `/block` + - [rpc] `/block_results` response format updated (see RPC docs for details) + ``` + { + "jsonrpc": "2.0", + "id": "", + "result": { + "height": "2109", + "txs_results": null, + "begin_block_events": null, + "end_block_events": null, + "validator_updates": null, + "consensus_param_updates": null + } + } + ``` - Apps - Go API + - [libs/pubsub] [\#4070](https://github.com/tendermint/tendermint/pull/4070) `Query#(Matches|Conditions)` returns an error. + +- Blockchain Protocol + - [abci] \#2521 Remove `TotalTxs` and `NumTxs` from `Header` + +- P2P Protocol + - [p2p] [\3668](https://github.com/tendermint/tendermint/pull/3668) Make `SecretConnection` non-malleable ### FEATURES: ### IMPROVEMENTS: -- [rpc] \#2010 Add NewHTTPWithClient and NewJSONRPCClientWithHTTPClient (note these and NewHTTP, NewJSONRPCClient functions panic if remote is invalid) (@gracenoah) -- [rpc] \#3984 Add `MempoolClient` interface to `Client` interface -- [rpc] \#3882 Add custom marshalers to proto messages to disable `omitempty` +- [mempool] [\#4083](https://github.com/tendermint/tendermint/pull/4083) Added TxInfo parameter to CheckTx(), and removed CheckTxWithInfo() (@erikgrinaker) +- [mempool] [\#4057](https://github.com/tendermint/tendermint/issues/4057) Include peer ID when logging rejected txns (@erikgrinaker) +- [tools] [\#4023](https://github.com/tendermint/tendermint/issues/4023) Improved `tm-monitor` formatting of start time and avg tx throughput (@erikgrinaker) +- [libs/pubsub] [\#4070](https://github.com/tendermint/tendermint/pull/4070) No longer panic in `Query#(Matches|Conditions)` preferring to return an error instead. +- [libs/pubsub] [\#4070](https://github.com/tendermint/tendermint/pull/4070) Strip out non-numeric characters when attempting to match numeric values. +- [p2p] [\#3991](https://github.com/tendermint/tendermint/issues/3991) Log "has been established or dialed" as debug log instead of Error for connected peers (@whunmr) +- [rpc] [\#4077](https://github.com/tendermint/tendermint/pull/4077) Added support for `EXISTS` clause to the Websocket query interface. +- [privval] Add `SignerDialerEndpointRetryWaitInterval` option (@cosmostuba) +- [crypto] Add `RegisterKeyType` to amino to allow external key types registration (@austinabell) +- [rpc] \#3188 Added `block_size` to `BlockMeta` this is reflected in `/blockchain` +- [types] \#2521 Add `NumTxs` to `BlockMeta` and `EventDataNewBlockHeader` ### BUG FIXES: -- [consensus] \#3908 Wait `timeout_commit` to pass even if `create_empty_blocks` is `false` -- [mempool] \#3968 Fix memory loading error on 32-bit machines (@jon-certik) +- [tools] [\#4023](https://github.com/tendermint/tendermint/issues/4023) Refresh `tm-monitor` health when validator count is updated (@erikgrinaker) +- [state] [\#4104](https://github.com/tendermint/tendermint/pull/4104) txindex/kv: Fsync data to disk immediately after receiving it (@guagualvcha) +- [state] [\#4095](https://github.com/tendermint/tendermint/pull/4095) txindex/kv: Return an error if there's one when the user searches for a tx (hash=X) (@hsyis) +- [rpc/lib] [\#4051](https://github.com/tendermint/tendermint/pull/4131) Fix RPC client, which was previously resolving https protocol to http (@yenkhoon) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1b9ea4409..8b0f32be9 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -185,7 +185,7 @@ includes its continuous integration status using a badge in the `README.md`. ### RPC Testing -If you contribute to the RPC endpoints it's important to document your changes in the [Swagger file](./docs/spec/rpc/swagger.yaml) +If you contribute to the RPC endpoints it's important to document your changes in the [Swagger file](./rpc/swagger/swagger.yaml) To test your changes you should install `nodejs` and run: ```bash diff --git a/DOCKER/Dockerfile b/DOCKER/Dockerfile index 6a7f289f5..c3c186e05 100644 --- a/DOCKER/Dockerfile +++ b/DOCKER/Dockerfile @@ -36,4 +36,3 @@ STOPSIGNAL SIGTERM ARG BINARY=tendermint COPY $BINARY /usr/bin/tendermint - diff --git a/DOCKER/Dockerfile.abci b/DOCKER/Dockerfile.abci deleted file mode 100644 index 52a3d9e0b..000000000 --- a/DOCKER/Dockerfile.abci +++ /dev/null @@ -1,23 +0,0 @@ -FROM golang:latest - -RUN mkdir -p /go/src/github.com/tendermint/abci -WORKDIR /go/src/github.com/tendermint/abci - -COPY Makefile /go/src/github.com/tendermint/abci/ - -# see make protoc for details on ldconfig -RUN make get_protoc && ldconfig - -# killall is used in tests -RUN apt-get update && apt-get install -y \ - psmisc \ - && rm -rf /var/lib/apt/lists/* - -COPY Gopkg.toml /go/src/github.com/tendermint/abci/ -COPY Gopkg.lock /go/src/github.com/tendermint/abci/ -RUN make tools - -# see https://github.com/golang/dep/issues/1312 -RUN dep ensure -vendor-only - -COPY . /go/src/github.com/tendermint/abci diff --git a/DOCKER/Dockerfile.testing b/DOCKER/Dockerfile.testing index a658aeb10..7f86ee180 100644 --- a/DOCKER/Dockerfile.testing +++ b/DOCKER/Dockerfile.testing @@ -1,5 +1,4 @@ -FROM golang:1.12 - +FROM golang:latest # Grab deps (jq, hexdump, xxd, killall) RUN apt-get update && \ @@ -15,4 +14,3 @@ VOLUME /go EXPOSE 26656 EXPOSE 26657 - diff --git a/DOCKER/Makefile b/DOCKER/Makefile index 41fb60ac8..8f6dff372 100644 --- a/DOCKER/Makefile +++ b/DOCKER/Makefile @@ -4,16 +4,10 @@ build: push: @sh -c "'$(CURDIR)/push.sh'" -build_develop: - docker build -t "tendermint/tendermint:develop" -f Dockerfile.develop . - build_testing: docker build --tag tendermint/testing -f ./Dockerfile.testing . -push_develop: - docker push "tendermint/tendermint:develop" - build_amazonlinux_buildimage: docker build -t "tendermint/tendermint:build_c-amazonlinux" -f Dockerfile.build_c-amazonlinux . -.PHONY: build build_develop push push_develop +.PHONY: build push build_testing build_amazonlinux_buildimage diff --git a/DOCKER/README.md b/DOCKER/README.md index 57e631aaa..775922248 100644 --- a/DOCKER/README.md +++ b/DOCKER/README.md @@ -2,27 +2,19 @@ ## Supported tags and respective `Dockerfile` links -- `0.17.1`, `latest` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/208ac32fa266657bd6c304e84ec828aa252bb0b8/DOCKER/Dockerfile) -- `0.15.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/170777300ea92dc21a8aec1abc16cb51812513a4/DOCKER/Dockerfile) -- `0.13.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/a28b3fff49dce2fb31f90abb2fc693834e0029c2/DOCKER/Dockerfile) -- `0.12.1` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/457c688346b565e90735431619ca3ca597ef9007/DOCKER/Dockerfile) -- `0.12.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/70d8afa6e952e24c573ece345560a5971bf2cc0e/DOCKER/Dockerfile) -- `0.11.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/9177cc1f64ca88a4a0243c5d1773d10fba67e201/DOCKER/Dockerfile) -- `0.10.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/e5342f4054ab784b2cd6150e14f01053d7c8deb2/DOCKER/Dockerfile) -- `0.9.1`, `0.9`, [(Dockerfile)](https://github.com/tendermint/tendermint/blob/809e0e8c5933604ba8b2d096803ada7c5ec4dfd3/DOCKER/Dockerfile) -- `0.9.0` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/d474baeeea6c22b289e7402449572f7c89ee21da/DOCKER/Dockerfile) -- `0.8.0`, `0.8` [(Dockerfile)](https://github.com/tendermint/tendermint/blob/bf64dd21fdb193e54d8addaaaa2ecf7ac371de8c/DOCKER/Dockerfile) +DockerHub tags for official releases are [here](https://hub.docker.com/r/tendermint/tendermint/tags/). The "latest" tag will always point to the highest version number. + +Official releases can be found [here](https://github.com/tendermint/tendermint/releases). + +The Dockerfile for tendermint is not expected to change in the near future. The master file used for all builds can be found [here](https://raw.githubusercontent.com/tendermint/tendermint/master/DOCKER/Dockerfile). + +Respective versioned files can be found https://raw.githubusercontent.com/tendermint/tendermint/vX.XX.XX/DOCKER/Dockerfile (replace the Xs with the version number). ## Quick reference -- **Where to get help:** - [cosmos.network/ecosystem](https://cosmos.network/ecosystem) - -- **Where to file issues:** - [Tendermint Issues](https://github.com/tendermint/tendermint/issues) - -- **Supported Docker versions:** - [the latest release](https://github.com/moby/moby/releases) (down to 1.6 on a best-effort basis) +- **Where to get help:** https://tendermint.com/ +- **Where to file issues:** https://github.com/tendermint/tendermint/issues +- **Supported Docker versions:** [the latest release](https://github.com/moby/moby/releases) (down to 1.6 on a best-effort basis) ## Tendermint diff --git a/Makefile b/Makefile index e7937cfc6..472b3a0ea 100644 --- a/Makefile +++ b/Makefile @@ -153,6 +153,26 @@ lint: DESTINATION = ./index.html.md +########################################################### +### Documentation + +build-docs: + cd docs && \ + while read p; do \ + (git checkout $${p} && npm install && VUEPRESS_BASE="/$${p}/" npm run build) ; \ + mkdir -p ~/output/$${p} ; \ + cp -r .vuepress/dist/* ~/output/$${p}/ ; \ + cp ~/output/$${p}/index.html ~/output ; \ + done < versions ; + +sync-docs: + cd ~/output && \ + echo "role_arn = ${DEPLOYMENT_ROLE_ARN}" >> /root/.aws/config ; \ + echo "CI job = ${CIRCLE_BUILD_URL}" >> version.html ; \ + aws s3 sync . s3://${WEBSITE_BUCKET} --profile terraform --delete ; \ + aws cloudfront create-invalidation --distribution-id ${CF_DISTRIBUTION_ID} --profile terraform --path "/*" ; +.PHONY: sync-docs + ########################################################### ### Docker image @@ -227,7 +247,7 @@ contract-tests: # unless there is a reason not to. # https://www.gnu.org/software/make/manual/html_node/Phony-Targets.html .PHONY: check build build_race build_abci dist install install_abci check_tools tools update_tools draw_deps \ - get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver fmt rpc-docs build-linux localnet-start \ + get_protoc protoc_abci protoc_libs gen_certs clean_certs grpc_dbserver fmt build-linux localnet-start \ localnet-stop build-docker build-docker-localnode sentry-start sentry-config sentry-stop protoc_grpc protoc_all \ build_c install_c test_with_deadlock cleanup_after_test_with_deadlock lint build-contract-tests-hooks contract-tests \ build_c-amazonlinux diff --git a/README.md b/README.md index d7928f668..c1d26ed68 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ Sessions](/docs/DEV_SESSIONS.md) and read some [Architectural Decision Records](https://github.com/tendermint/tendermint/tree/master/docs/architecture). Learn more by reading the code and comparing it to the -[specification](https://github.com/tendermint/tendermint/tree/develop/docs/spec). +[specification](https://github.com/tendermint/tendermint/tree/master/docs/spec). ## Versioning diff --git a/UPGRADING.md b/UPGRADING.md index af42d2a66..fc98982a7 100644 --- a/UPGRADING.md +++ b/UPGRADING.md @@ -110,7 +110,6 @@ The ABCI Application interface changed slightly so the CheckTx and DeliverTx methods now take Request structs. The contents of these structs are just the raw tx bytes, which were previously passed in as the argument. - ## v0.31.6 There are no breaking changes in this release except Go API of p2p and @@ -193,13 +192,15 @@ due to changes in how various data structures are hashed. Any implementations of Tendermint blockchain verification, including lite clients, will need to be updated. For specific details: + - [Merkle tree](./docs/spec/blockchain/encoding.md#merkle-trees) - [ConsensusParams](./docs/spec/blockchain/state.md#consensusparams) There was also a small change to field ordering in the vote struct. Any implementations of an out-of-process validator (like a Key-Management Server) will need to be updated. For specific details: -- [Vote](https://github.com/tendermint/tendermint/blob/develop/docs/spec/consensus/signing.md#votes) + +- [Vote](https://github.com/tendermint/tendermint/blob/master/docs/spec/consensus/signing.md#votes) Finally, the proposer selection algorithm continues to evolve. See the [work-in-progress @@ -438,7 +439,6 @@ required to maintain a map from validator addresses to pubkeys since v0.23 (when pubkeys were removed from RequestBeginBlock), but now they may need to track multiple validator sets at once to accomodate this delay. - ### Block Size The `ConsensusParams.BlockSize.MaxTxs` was removed in favour of diff --git a/abci/client/socket_client.go b/abci/client/socket_client.go index 7b1e4cd8d..062d50d4e 100644 --- a/abci/client/socket_client.go +++ b/abci/client/socket_client.go @@ -5,6 +5,7 @@ import ( "container/list" "errors" "fmt" + "io" "net" "reflect" "sync" @@ -119,7 +120,7 @@ func (cli *socketClient) SetResponseCallback(resCb Callback) { //---------------------------------------- -func (cli *socketClient) sendRequestsRoutine(conn net.Conn) { +func (cli *socketClient) sendRequestsRoutine(conn io.Writer) { w := bufio.NewWriter(conn) for { @@ -151,7 +152,7 @@ func (cli *socketClient) sendRequestsRoutine(conn net.Conn) { } } -func (cli *socketClient) recvResponseRoutine(conn net.Conn) { +func (cli *socketClient) recvResponseRoutine(conn io.Reader) { r := bufio.NewReader(conn) // Buffer reads for { diff --git a/abci/cmd/abci-cli/abci-cli.go b/abci/cmd/abci-cli/abci-cli.go index 31721b21b..32560f427 100644 --- a/abci/cmd/abci-cli/abci-cli.go +++ b/abci/cmd/abci-cli/abci-cli.go @@ -111,16 +111,28 @@ func Execute() error { } func addGlobalFlags() { - RootCmd.PersistentFlags().StringVarP(&flagAddress, "address", "", "tcp://0.0.0.0:26658", "address of application socket") + RootCmd.PersistentFlags().StringVarP(&flagAddress, + "address", + "", + "tcp://0.0.0.0:26658", + "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().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().BoolVarP(&flagProve, + "prove", + "", + false, + "whether or not to return a merkle proof of the query result") } func addCounterFlags() { diff --git a/abci/example/example_test.go b/abci/example/example_test.go index 74510700b..163545055 100644 --- a/abci/example/example_test.go +++ b/abci/example/example_test.go @@ -111,7 +111,7 @@ func dialerFunc(ctx context.Context, addr string) (net.Conn, error) { return cmn.Connect(addr) } -func testGRPCSync(t *testing.T, app *types.GRPCApplication) { +func testGRPCSync(t *testing.T, app types.ABCIApplicationServer) { numDeliverTxs := 2000 // Start the listener diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index 80e60fdec..d931c3b13 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -175,7 +175,12 @@ func TestValUpdates(t *testing.T) { } -func makeApplyBlock(t *testing.T, kvstore types.Application, heightInt int, diff []types.ValidatorUpdate, txs ...[]byte) { +func makeApplyBlock( + t *testing.T, + kvstore types.Application, + heightInt int, + diff []types.ValidatorUpdate, + txs ...[]byte) { // make and apply block height := int64(heightInt) hash := []byte("foo") diff --git a/abci/server/socket_server.go b/abci/server/socket_server.go index 3e1d775d7..8dbd934b4 100644 --- a/abci/server/socket_server.go +++ b/abci/server/socket_server.go @@ -144,7 +144,7 @@ func (s *SocketServer) waitForClose(closeConn chan error, connID int) { } // Read requests from conn and deal with them -func (s *SocketServer) handleRequests(closeConn chan error, conn net.Conn, responses chan<- *types.Response) { +func (s *SocketServer) handleRequests(closeConn chan error, conn io.Reader, responses chan<- *types.Response) { var count int var bufReader = bufio.NewReader(conn) @@ -215,7 +215,7 @@ func (s *SocketServer) handleRequest(req *types.Request, responses chan<- *types } // Pull responses from 'responses' and write them to conn. -func (s *SocketServer) handleResponses(closeConn chan error, conn net.Conn, responses <-chan *types.Response) { +func (s *SocketServer) handleResponses(closeConn chan error, conn io.Writer, responses <-chan *types.Response) { var count int var bufWriter = bufio.NewWriter(conn) for { diff --git a/abci/tests/benchmarks/simple/simple.go b/abci/tests/benchmarks/simple/simple.go index b0819799b..b5cfb044d 100644 --- a/abci/tests/benchmarks/simple/simple.go +++ b/abci/tests/benchmarks/simple/simple.go @@ -3,8 +3,8 @@ package main import ( "bufio" "fmt" + "io" "log" - "net" "reflect" "github.com/tendermint/tendermint/abci/types" @@ -33,7 +33,7 @@ func main() { } } -func makeRequest(conn net.Conn, req *types.Request) (*types.Response, error) { +func makeRequest(conn io.ReadWriter, req *types.Request) (*types.Response, error) { var bufWriter = bufio.NewWriter(conn) // Write desired request diff --git a/abci/tests/test_app/main.go b/abci/tests/test_app/main.go index 8f45cec3c..ae47ac6f9 100644 --- a/abci/tests/test_app/main.go +++ b/abci/tests/test_app/main.go @@ -36,7 +36,7 @@ func ensureABCIIsUp(typ string, n int) error { } for i := 0; i < n; i++ { - cmd := exec.Command("bash", "-c", cmdString) // nolint: gas + cmd := exec.Command("bash", "-c", cmdString) _, err = cmd.CombinedOutput() if err == nil { break @@ -53,7 +53,7 @@ func testCounter() { } fmt.Printf("Running %s test with abci=%s\n", abciApp, abciType) - cmd := exec.Command("bash", "-c", fmt.Sprintf("abci-cli %s", abciApp)) // nolint: gas + cmd := exec.Command("bash", "-c", fmt.Sprintf("abci-cli %s", abciApp)) cmd.Stdout = os.Stdout if err := cmd.Start(); err != nil { log.Fatalf("starting %q err: %v", abciApp, err) diff --git a/abci/types/application.go b/abci/types/application.go index 90518851d..9dd77c4ef 100644 --- a/abci/types/application.go +++ b/abci/types/application.go @@ -18,7 +18,7 @@ type Application interface { CheckTx(RequestCheckTx) ResponseCheckTx // Validate a tx for the mempool // Consensus Connection - InitChain(RequestInitChain) ResponseInitChain // Initialize blockchain with validators and other info from TendermintCore + InitChain(RequestInitChain) ResponseInitChain // Initialize blockchain w validators/other info from TendermintCore BeginBlock(RequestBeginBlock) ResponseBeginBlock // Signals the beginning of a block DeliverTx(RequestDeliverTx) ResponseDeliverTx // Deliver a tx for full processing EndBlock(RequestEndBlock) ResponseEndBlock // Signals the end of a block, returns changes to the validator set diff --git a/abci/types/messages_test.go b/abci/types/messages_test.go index b9ba72dcf..e0c0978ea 100644 --- a/abci/types/messages_test.go +++ b/abci/types/messages_test.go @@ -62,7 +62,8 @@ func TestWriteReadMessageSimple(t *testing.T) { func TestWriteReadMessage(t *testing.T) { cases := []proto.Message{ &Header{ - NumTxs: 4, + Height: 4, + ChainID: "test", }, // TODO: add the rest } diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 926d528ad..4d5eef481 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -3,28 +3,26 @@ package types -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import merkle "github.com/tendermint/tendermint/crypto/merkle" -import common "github.com/tendermint/tendermint/libs/common" - -import time "time" - -import bytes "bytes" - import ( - context "golang.org/x/net/context" + bytes "bytes" + context "context" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + golang_proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/timestamp" + merkle "github.com/tendermint/tendermint/crypto/merkle" + common "github.com/tendermint/tendermint/libs/common" grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" + time "time" ) -import github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" - -import io "io" - // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal var _ = golang_proto.Marshal @@ -36,7 +34,7 @@ var _ = time.Kitchen // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type CheckTxType int32 @@ -49,6 +47,7 @@ var CheckTxType_name = map[int32]string{ 0: "New", 1: "Recheck", } + var CheckTxType_value = map[string]int32{ "New": 0, "Recheck": 1, @@ -57,8 +56,9 @@ var CheckTxType_value = map[string]int32{ func (x CheckTxType) String() string { return proto.EnumName(CheckTxType_name, int32(x)) } + func (CheckTxType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{0} + return fileDescriptor_9f1eaa49c51fa1ac, []int{0} } type Request struct { @@ -84,7 +84,7 @@ func (m *Request) Reset() { *m = Request{} } func (m *Request) String() string { return proto.CompactTextString(m) } func (*Request) ProtoMessage() {} func (*Request) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{0} + return fileDescriptor_9f1eaa49c51fa1ac, []int{0} } func (m *Request) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -94,15 +94,15 @@ func (m *Request) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Request.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Request) XXX_Merge(src proto.Message) { - xxx_messageInfo_Request.Merge(dst, src) +func (m *Request) XXX_Merge(src proto.Message) { + xxx_messageInfo_Request.Merge(m, src) } func (m *Request) XXX_Size() int { return m.Size() @@ -121,37 +121,37 @@ type isRequest_Value interface { } type Request_Echo struct { - Echo *RequestEcho `protobuf:"bytes,2,opt,name=echo,oneof"` + Echo *RequestEcho `protobuf:"bytes,2,opt,name=echo,proto3,oneof"` } type Request_Flush struct { - Flush *RequestFlush `protobuf:"bytes,3,opt,name=flush,oneof"` + Flush *RequestFlush `protobuf:"bytes,3,opt,name=flush,proto3,oneof"` } type Request_Info struct { - Info *RequestInfo `protobuf:"bytes,4,opt,name=info,oneof"` + Info *RequestInfo `protobuf:"bytes,4,opt,name=info,proto3,oneof"` } type Request_SetOption struct { - SetOption *RequestSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,oneof"` + SetOption *RequestSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,proto3,oneof"` } type Request_InitChain struct { - InitChain *RequestInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,oneof"` + InitChain *RequestInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,proto3,oneof"` } type Request_Query struct { - Query *RequestQuery `protobuf:"bytes,7,opt,name=query,oneof"` + Query *RequestQuery `protobuf:"bytes,7,opt,name=query,proto3,oneof"` } type Request_BeginBlock struct { - BeginBlock *RequestBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,oneof"` + BeginBlock *RequestBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,proto3,oneof"` } type Request_CheckTx struct { - CheckTx *RequestCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,oneof"` + CheckTx *RequestCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,proto3,oneof"` } type Request_DeliverTx struct { - DeliverTx *RequestDeliverTx `protobuf:"bytes,19,opt,name=deliver_tx,json=deliverTx,oneof"` + DeliverTx *RequestDeliverTx `protobuf:"bytes,19,opt,name=deliver_tx,json=deliverTx,proto3,oneof"` } type Request_EndBlock struct { - EndBlock *RequestEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,oneof"` + EndBlock *RequestEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,proto3,oneof"` } type Request_Commit struct { - Commit *RequestCommit `protobuf:"bytes,12,opt,name=commit,oneof"` + Commit *RequestCommit `protobuf:"bytes,12,opt,name=commit,proto3,oneof"` } func (*Request_Echo) isRequest_Value() {} @@ -250,9 +250,9 @@ func (m *Request) GetCommit() *RequestCommit { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Request) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Request_OneofMarshaler, _Request_OneofUnmarshaler, _Request_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Request) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Request_Echo)(nil), (*Request_Flush)(nil), (*Request_Info)(nil), @@ -267,234 +267,6 @@ func (*Request) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error } } -func _Request_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Request) - // value - switch x := m.Value.(type) { - case *Request_Echo: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Echo); err != nil { - return err - } - case *Request_Flush: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Flush); err != nil { - return err - } - case *Request_Info: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Info); err != nil { - return err - } - case *Request_SetOption: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SetOption); err != nil { - return err - } - case *Request_InitChain: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitChain); err != nil { - return err - } - case *Request_Query: - _ = b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Query); err != nil { - return err - } - case *Request_BeginBlock: - _ = b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BeginBlock); err != nil { - return err - } - case *Request_CheckTx: - _ = b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.CheckTx); err != nil { - return err - } - case *Request_DeliverTx: - _ = b.EncodeVarint(19<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.DeliverTx); err != nil { - return err - } - case *Request_EndBlock: - _ = b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.EndBlock); err != nil { - return err - } - case *Request_Commit: - _ = b.EncodeVarint(12<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Commit); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Request.Value has unexpected type %T", x) - } - return nil -} - -func _Request_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Request) - switch tag { - case 2: // value.echo - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestEcho) - err := b.DecodeMessage(msg) - m.Value = &Request_Echo{msg} - return true, err - case 3: // value.flush - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestFlush) - err := b.DecodeMessage(msg) - m.Value = &Request_Flush{msg} - return true, err - case 4: // value.info - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestInfo) - err := b.DecodeMessage(msg) - m.Value = &Request_Info{msg} - return true, err - case 5: // value.set_option - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestSetOption) - err := b.DecodeMessage(msg) - m.Value = &Request_SetOption{msg} - return true, err - case 6: // value.init_chain - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestInitChain) - err := b.DecodeMessage(msg) - m.Value = &Request_InitChain{msg} - return true, err - case 7: // value.query - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestQuery) - err := b.DecodeMessage(msg) - m.Value = &Request_Query{msg} - return true, err - case 8: // value.begin_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestBeginBlock) - err := b.DecodeMessage(msg) - m.Value = &Request_BeginBlock{msg} - return true, err - case 9: // value.check_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestCheckTx) - err := b.DecodeMessage(msg) - m.Value = &Request_CheckTx{msg} - return true, err - case 19: // value.deliver_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestDeliverTx) - err := b.DecodeMessage(msg) - m.Value = &Request_DeliverTx{msg} - return true, err - case 11: // value.end_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestEndBlock) - err := b.DecodeMessage(msg) - m.Value = &Request_EndBlock{msg} - return true, err - case 12: // value.commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(RequestCommit) - err := b.DecodeMessage(msg) - m.Value = &Request_Commit{msg} - return true, err - default: - return false, nil - } -} - -func _Request_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Request) - // value - switch x := m.Value.(type) { - case *Request_Echo: - s := proto.Size(x.Echo) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Flush: - s := proto.Size(x.Flush) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Info: - s := proto.Size(x.Info) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_SetOption: - s := proto.Size(x.SetOption) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_InitChain: - s := proto.Size(x.InitChain) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Query: - s := proto.Size(x.Query) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_BeginBlock: - s := proto.Size(x.BeginBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_CheckTx: - s := proto.Size(x.CheckTx) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_DeliverTx: - s := proto.Size(x.DeliverTx) - n += 2 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_EndBlock: - s := proto.Size(x.EndBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Request_Commit: - s := proto.Size(x.Commit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - type RequestEcho struct { Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -506,7 +278,7 @@ func (m *RequestEcho) Reset() { *m = RequestEcho{} } func (m *RequestEcho) String() string { return proto.CompactTextString(m) } func (*RequestEcho) ProtoMessage() {} func (*RequestEcho) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{1} + return fileDescriptor_9f1eaa49c51fa1ac, []int{1} } func (m *RequestEcho) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -516,15 +288,15 @@ func (m *RequestEcho) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestEcho.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestEcho) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestEcho.Merge(dst, src) +func (m *RequestEcho) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestEcho.Merge(m, src) } func (m *RequestEcho) XXX_Size() int { return m.Size() @@ -552,7 +324,7 @@ func (m *RequestFlush) Reset() { *m = RequestFlush{} } func (m *RequestFlush) String() string { return proto.CompactTextString(m) } func (*RequestFlush) ProtoMessage() {} func (*RequestFlush) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{2} + return fileDescriptor_9f1eaa49c51fa1ac, []int{2} } func (m *RequestFlush) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -562,15 +334,15 @@ func (m *RequestFlush) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestFlush.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestFlush) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestFlush.Merge(dst, src) +func (m *RequestFlush) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestFlush.Merge(m, src) } func (m *RequestFlush) XXX_Size() int { return m.Size() @@ -594,7 +366,7 @@ func (m *RequestInfo) Reset() { *m = RequestInfo{} } func (m *RequestInfo) String() string { return proto.CompactTextString(m) } func (*RequestInfo) ProtoMessage() {} func (*RequestInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{3} + return fileDescriptor_9f1eaa49c51fa1ac, []int{3} } func (m *RequestInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -604,15 +376,15 @@ func (m *RequestInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestInfo.Merge(dst, src) +func (m *RequestInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestInfo.Merge(m, src) } func (m *RequestInfo) XXX_Size() int { return m.Size() @@ -657,7 +429,7 @@ func (m *RequestSetOption) Reset() { *m = RequestSetOption{} } func (m *RequestSetOption) String() string { return proto.CompactTextString(m) } func (*RequestSetOption) ProtoMessage() {} func (*RequestSetOption) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{4} + return fileDescriptor_9f1eaa49c51fa1ac, []int{4} } func (m *RequestSetOption) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -667,15 +439,15 @@ func (m *RequestSetOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_RequestSetOption.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestSetOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestSetOption.Merge(dst, src) +func (m *RequestSetOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestSetOption.Merge(m, src) } func (m *RequestSetOption) XXX_Size() int { return m.Size() @@ -701,10 +473,10 @@ func (m *RequestSetOption) GetValue() string { } type RequestInitChain struct { - Time time.Time `protobuf:"bytes,1,opt,name=time,stdtime" json:"time"` + Time time.Time `protobuf:"bytes,1,opt,name=time,proto3,stdtime" json:"time"` ChainId string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - ConsensusParams *ConsensusParams `protobuf:"bytes,3,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` - Validators []ValidatorUpdate `protobuf:"bytes,4,rep,name=validators" json:"validators"` + ConsensusParams *ConsensusParams `protobuf:"bytes,3,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params,omitempty"` + Validators []ValidatorUpdate `protobuf:"bytes,4,rep,name=validators,proto3" json:"validators"` AppStateBytes []byte `protobuf:"bytes,5,opt,name=app_state_bytes,json=appStateBytes,proto3" json:"app_state_bytes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -715,7 +487,7 @@ func (m *RequestInitChain) Reset() { *m = RequestInitChain{} } func (m *RequestInitChain) String() string { return proto.CompactTextString(m) } func (*RequestInitChain) ProtoMessage() {} func (*RequestInitChain) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{5} + return fileDescriptor_9f1eaa49c51fa1ac, []int{5} } func (m *RequestInitChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -725,15 +497,15 @@ func (m *RequestInitChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_RequestInitChain.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestInitChain) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestInitChain.Merge(dst, src) +func (m *RequestInitChain) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestInitChain.Merge(m, src) } func (m *RequestInitChain) XXX_Size() int { return m.Size() @@ -793,7 +565,7 @@ func (m *RequestQuery) Reset() { *m = RequestQuery{} } func (m *RequestQuery) String() string { return proto.CompactTextString(m) } func (*RequestQuery) ProtoMessage() {} func (*RequestQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{6} + return fileDescriptor_9f1eaa49c51fa1ac, []int{6} } func (m *RequestQuery) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -803,15 +575,15 @@ func (m *RequestQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_RequestQuery.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestQuery.Merge(dst, src) +func (m *RequestQuery) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestQuery.Merge(m, src) } func (m *RequestQuery) XXX_Size() int { return m.Size() @@ -852,9 +624,9 @@ 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"` - LastCommitInfo LastCommitInfo `protobuf:"bytes,3,opt,name=last_commit_info,json=lastCommitInfo" json:"last_commit_info"` - ByzantineValidators []Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators" json:"byzantine_validators"` + Header Header `protobuf:"bytes,2,opt,name=header,proto3" json:"header"` + LastCommitInfo LastCommitInfo `protobuf:"bytes,3,opt,name=last_commit_info,json=lastCommitInfo,proto3" json:"last_commit_info"` + ByzantineValidators []Evidence `protobuf:"bytes,4,rep,name=byzantine_validators,json=byzantineValidators,proto3" json:"byzantine_validators"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -864,7 +636,7 @@ func (m *RequestBeginBlock) Reset() { *m = RequestBeginBlock{} } func (m *RequestBeginBlock) String() string { return proto.CompactTextString(m) } func (*RequestBeginBlock) ProtoMessage() {} func (*RequestBeginBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{7} + return fileDescriptor_9f1eaa49c51fa1ac, []int{7} } func (m *RequestBeginBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -874,15 +646,15 @@ func (m *RequestBeginBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_RequestBeginBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestBeginBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestBeginBlock.Merge(dst, src) +func (m *RequestBeginBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestBeginBlock.Merge(m, src) } func (m *RequestBeginBlock) XXX_Size() int { return m.Size() @@ -933,7 +705,7 @@ func (m *RequestCheckTx) Reset() { *m = RequestCheckTx{} } func (m *RequestCheckTx) String() string { return proto.CompactTextString(m) } func (*RequestCheckTx) ProtoMessage() {} func (*RequestCheckTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{8} + return fileDescriptor_9f1eaa49c51fa1ac, []int{8} } func (m *RequestCheckTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -943,15 +715,15 @@ func (m *RequestCheckTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_RequestCheckTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestCheckTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestCheckTx.Merge(dst, src) +func (m *RequestCheckTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestCheckTx.Merge(m, src) } func (m *RequestCheckTx) XXX_Size() int { return m.Size() @@ -987,7 +759,7 @@ func (m *RequestDeliverTx) Reset() { *m = RequestDeliverTx{} } func (m *RequestDeliverTx) String() string { return proto.CompactTextString(m) } func (*RequestDeliverTx) ProtoMessage() {} func (*RequestDeliverTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{9} + return fileDescriptor_9f1eaa49c51fa1ac, []int{9} } func (m *RequestDeliverTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -997,15 +769,15 @@ func (m *RequestDeliverTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_RequestDeliverTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestDeliverTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestDeliverTx.Merge(dst, src) +func (m *RequestDeliverTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestDeliverTx.Merge(m, src) } func (m *RequestDeliverTx) XXX_Size() int { return m.Size() @@ -1034,7 +806,7 @@ func (m *RequestEndBlock) Reset() { *m = RequestEndBlock{} } func (m *RequestEndBlock) String() string { return proto.CompactTextString(m) } func (*RequestEndBlock) ProtoMessage() {} func (*RequestEndBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{10} + return fileDescriptor_9f1eaa49c51fa1ac, []int{10} } func (m *RequestEndBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1044,15 +816,15 @@ func (m *RequestEndBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_RequestEndBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestEndBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestEndBlock.Merge(dst, src) +func (m *RequestEndBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestEndBlock.Merge(m, src) } func (m *RequestEndBlock) XXX_Size() int { return m.Size() @@ -1080,7 +852,7 @@ func (m *RequestCommit) Reset() { *m = RequestCommit{} } func (m *RequestCommit) String() string { return proto.CompactTextString(m) } func (*RequestCommit) ProtoMessage() {} func (*RequestCommit) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{11} + return fileDescriptor_9f1eaa49c51fa1ac, []int{11} } func (m *RequestCommit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1090,15 +862,15 @@ func (m *RequestCommit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_RequestCommit.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *RequestCommit) XXX_Merge(src proto.Message) { - xxx_messageInfo_RequestCommit.Merge(dst, src) +func (m *RequestCommit) XXX_Merge(src proto.Message) { + xxx_messageInfo_RequestCommit.Merge(m, src) } func (m *RequestCommit) XXX_Size() int { return m.Size() @@ -1133,7 +905,7 @@ func (m *Response) Reset() { *m = Response{} } func (m *Response) String() string { return proto.CompactTextString(m) } func (*Response) ProtoMessage() {} func (*Response) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{12} + return fileDescriptor_9f1eaa49c51fa1ac, []int{12} } func (m *Response) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1143,15 +915,15 @@ func (m *Response) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Response.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Response) XXX_Merge(src proto.Message) { - xxx_messageInfo_Response.Merge(dst, src) +func (m *Response) XXX_Merge(src proto.Message) { + xxx_messageInfo_Response.Merge(m, src) } func (m *Response) XXX_Size() int { return m.Size() @@ -1170,40 +942,40 @@ type isResponse_Value interface { } type Response_Exception struct { - Exception *ResponseException `protobuf:"bytes,1,opt,name=exception,oneof"` + Exception *ResponseException `protobuf:"bytes,1,opt,name=exception,proto3,oneof"` } type Response_Echo struct { - Echo *ResponseEcho `protobuf:"bytes,2,opt,name=echo,oneof"` + Echo *ResponseEcho `protobuf:"bytes,2,opt,name=echo,proto3,oneof"` } type Response_Flush struct { - Flush *ResponseFlush `protobuf:"bytes,3,opt,name=flush,oneof"` + Flush *ResponseFlush `protobuf:"bytes,3,opt,name=flush,proto3,oneof"` } type Response_Info struct { - Info *ResponseInfo `protobuf:"bytes,4,opt,name=info,oneof"` + Info *ResponseInfo `protobuf:"bytes,4,opt,name=info,proto3,oneof"` } type Response_SetOption struct { - SetOption *ResponseSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,oneof"` + SetOption *ResponseSetOption `protobuf:"bytes,5,opt,name=set_option,json=setOption,proto3,oneof"` } type Response_InitChain struct { - InitChain *ResponseInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,oneof"` + InitChain *ResponseInitChain `protobuf:"bytes,6,opt,name=init_chain,json=initChain,proto3,oneof"` } type Response_Query struct { - Query *ResponseQuery `protobuf:"bytes,7,opt,name=query,oneof"` + Query *ResponseQuery `protobuf:"bytes,7,opt,name=query,proto3,oneof"` } type Response_BeginBlock struct { - BeginBlock *ResponseBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,oneof"` + BeginBlock *ResponseBeginBlock `protobuf:"bytes,8,opt,name=begin_block,json=beginBlock,proto3,oneof"` } type Response_CheckTx struct { - CheckTx *ResponseCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,oneof"` + CheckTx *ResponseCheckTx `protobuf:"bytes,9,opt,name=check_tx,json=checkTx,proto3,oneof"` } type Response_DeliverTx struct { - DeliverTx *ResponseDeliverTx `protobuf:"bytes,10,opt,name=deliver_tx,json=deliverTx,oneof"` + DeliverTx *ResponseDeliverTx `protobuf:"bytes,10,opt,name=deliver_tx,json=deliverTx,proto3,oneof"` } type Response_EndBlock struct { - EndBlock *ResponseEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,oneof"` + EndBlock *ResponseEndBlock `protobuf:"bytes,11,opt,name=end_block,json=endBlock,proto3,oneof"` } type Response_Commit struct { - Commit *ResponseCommit `protobuf:"bytes,12,opt,name=commit,oneof"` + Commit *ResponseCommit `protobuf:"bytes,12,opt,name=commit,proto3,oneof"` } func (*Response_Exception) isResponse_Value() {} @@ -1310,9 +1082,9 @@ func (m *Response) GetCommit() *ResponseCommit { return nil } -// XXX_OneofFuncs is for the internal use of the proto package. -func (*Response) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _Response_OneofMarshaler, _Response_OneofUnmarshaler, _Response_OneofSizer, []interface{}{ +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Response) XXX_OneofWrappers() []interface{} { + return []interface{}{ (*Response_Exception)(nil), (*Response_Echo)(nil), (*Response_Flush)(nil), @@ -1328,252 +1100,6 @@ func (*Response) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) erro } } -func _Response_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*Response) - // value - switch x := m.Value.(type) { - case *Response_Exception: - _ = b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Exception); err != nil { - return err - } - case *Response_Echo: - _ = b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Echo); err != nil { - return err - } - case *Response_Flush: - _ = b.EncodeVarint(3<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Flush); err != nil { - return err - } - case *Response_Info: - _ = b.EncodeVarint(4<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Info); err != nil { - return err - } - case *Response_SetOption: - _ = b.EncodeVarint(5<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.SetOption); err != nil { - return err - } - case *Response_InitChain: - _ = b.EncodeVarint(6<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitChain); err != nil { - return err - } - case *Response_Query: - _ = b.EncodeVarint(7<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Query); err != nil { - return err - } - case *Response_BeginBlock: - _ = b.EncodeVarint(8<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.BeginBlock); err != nil { - return err - } - case *Response_CheckTx: - _ = b.EncodeVarint(9<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.CheckTx); err != nil { - return err - } - case *Response_DeliverTx: - _ = b.EncodeVarint(10<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.DeliverTx); err != nil { - return err - } - case *Response_EndBlock: - _ = b.EncodeVarint(11<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.EndBlock); err != nil { - return err - } - case *Response_Commit: - _ = b.EncodeVarint(12<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.Commit); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("Response.Value has unexpected type %T", x) - } - return nil -} - -func _Response_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*Response) - switch tag { - case 1: // value.exception - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseException) - err := b.DecodeMessage(msg) - m.Value = &Response_Exception{msg} - return true, err - case 2: // value.echo - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseEcho) - err := b.DecodeMessage(msg) - m.Value = &Response_Echo{msg} - return true, err - case 3: // value.flush - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseFlush) - err := b.DecodeMessage(msg) - m.Value = &Response_Flush{msg} - return true, err - case 4: // value.info - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseInfo) - err := b.DecodeMessage(msg) - m.Value = &Response_Info{msg} - return true, err - case 5: // value.set_option - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseSetOption) - err := b.DecodeMessage(msg) - m.Value = &Response_SetOption{msg} - return true, err - case 6: // value.init_chain - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseInitChain) - err := b.DecodeMessage(msg) - m.Value = &Response_InitChain{msg} - return true, err - case 7: // value.query - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseQuery) - err := b.DecodeMessage(msg) - m.Value = &Response_Query{msg} - return true, err - case 8: // value.begin_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseBeginBlock) - err := b.DecodeMessage(msg) - m.Value = &Response_BeginBlock{msg} - return true, err - case 9: // value.check_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseCheckTx) - err := b.DecodeMessage(msg) - m.Value = &Response_CheckTx{msg} - return true, err - case 10: // value.deliver_tx - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseDeliverTx) - err := b.DecodeMessage(msg) - m.Value = &Response_DeliverTx{msg} - return true, err - case 11: // value.end_block - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseEndBlock) - err := b.DecodeMessage(msg) - m.Value = &Response_EndBlock{msg} - return true, err - case 12: // value.commit - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ResponseCommit) - err := b.DecodeMessage(msg) - m.Value = &Response_Commit{msg} - return true, err - default: - return false, nil - } -} - -func _Response_OneofSizer(msg proto.Message) (n int) { - m := msg.(*Response) - // value - switch x := m.Value.(type) { - case *Response_Exception: - s := proto.Size(x.Exception) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Echo: - s := proto.Size(x.Echo) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Flush: - s := proto.Size(x.Flush) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Info: - s := proto.Size(x.Info) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_SetOption: - s := proto.Size(x.SetOption) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_InitChain: - s := proto.Size(x.InitChain) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Query: - s := proto.Size(x.Query) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_BeginBlock: - s := proto.Size(x.BeginBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_CheckTx: - s := proto.Size(x.CheckTx) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_DeliverTx: - s := proto.Size(x.DeliverTx) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_EndBlock: - s := proto.Size(x.EndBlock) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case *Response_Commit: - s := proto.Size(x.Commit) - n += 1 // tag and wire - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - // nondeterministic type ResponseException struct { Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` @@ -1586,7 +1112,7 @@ func (m *ResponseException) Reset() { *m = ResponseException{} } func (m *ResponseException) String() string { return proto.CompactTextString(m) } func (*ResponseException) ProtoMessage() {} func (*ResponseException) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{13} + return fileDescriptor_9f1eaa49c51fa1ac, []int{13} } func (m *ResponseException) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1596,15 +1122,15 @@ func (m *ResponseException) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseException.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseException) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseException.Merge(dst, src) +func (m *ResponseException) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseException.Merge(m, src) } func (m *ResponseException) XXX_Size() int { return m.Size() @@ -1633,7 +1159,7 @@ func (m *ResponseEcho) Reset() { *m = ResponseEcho{} } func (m *ResponseEcho) String() string { return proto.CompactTextString(m) } func (*ResponseEcho) ProtoMessage() {} func (*ResponseEcho) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{14} + return fileDescriptor_9f1eaa49c51fa1ac, []int{14} } func (m *ResponseEcho) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1643,15 +1169,15 @@ func (m *ResponseEcho) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ResponseEcho.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseEcho) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseEcho.Merge(dst, src) +func (m *ResponseEcho) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseEcho.Merge(m, src) } func (m *ResponseEcho) XXX_Size() int { return m.Size() @@ -1679,7 +1205,7 @@ func (m *ResponseFlush) Reset() { *m = ResponseFlush{} } func (m *ResponseFlush) String() string { return proto.CompactTextString(m) } func (*ResponseFlush) ProtoMessage() {} func (*ResponseFlush) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{15} + return fileDescriptor_9f1eaa49c51fa1ac, []int{15} } func (m *ResponseFlush) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1689,15 +1215,15 @@ func (m *ResponseFlush) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_ResponseFlush.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseFlush) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseFlush.Merge(dst, src) +func (m *ResponseFlush) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseFlush.Merge(m, src) } func (m *ResponseFlush) XXX_Size() int { return m.Size() @@ -1723,7 +1249,7 @@ func (m *ResponseInfo) Reset() { *m = ResponseInfo{} } func (m *ResponseInfo) String() string { return proto.CompactTextString(m) } func (*ResponseInfo) ProtoMessage() {} func (*ResponseInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{16} + return fileDescriptor_9f1eaa49c51fa1ac, []int{16} } func (m *ResponseInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1733,15 +1259,15 @@ func (m *ResponseInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_ResponseInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseInfo.Merge(dst, src) +func (m *ResponseInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseInfo.Merge(m, src) } func (m *ResponseInfo) XXX_Size() int { return m.Size() @@ -1802,7 +1328,7 @@ func (m *ResponseSetOption) Reset() { *m = ResponseSetOption{} } func (m *ResponseSetOption) String() string { return proto.CompactTextString(m) } func (*ResponseSetOption) ProtoMessage() {} func (*ResponseSetOption) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{17} + return fileDescriptor_9f1eaa49c51fa1ac, []int{17} } func (m *ResponseSetOption) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1812,15 +1338,15 @@ func (m *ResponseSetOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseSetOption.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseSetOption) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseSetOption.Merge(dst, src) +func (m *ResponseSetOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseSetOption.Merge(m, src) } func (m *ResponseSetOption) XXX_Size() int { return m.Size() @@ -1853,8 +1379,8 @@ func (m *ResponseSetOption) GetInfo() string { } type ResponseInitChain struct { - ConsensusParams *ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams" json:"consensus_params,omitempty"` - Validators []ValidatorUpdate `protobuf:"bytes,2,rep,name=validators" json:"validators"` + ConsensusParams *ConsensusParams `protobuf:"bytes,1,opt,name=consensus_params,json=consensusParams,proto3" json:"consensus_params,omitempty"` + Validators []ValidatorUpdate `protobuf:"bytes,2,rep,name=validators,proto3" json:"validators"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -1864,7 +1390,7 @@ func (m *ResponseInitChain) Reset() { *m = ResponseInitChain{} } func (m *ResponseInitChain) String() string { return proto.CompactTextString(m) } func (*ResponseInitChain) ProtoMessage() {} func (*ResponseInitChain) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{18} + return fileDescriptor_9f1eaa49c51fa1ac, []int{18} } func (m *ResponseInitChain) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1874,15 +1400,15 @@ func (m *ResponseInitChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseInitChain.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseInitChain) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseInitChain.Merge(dst, src) +func (m *ResponseInitChain) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseInitChain.Merge(m, src) } func (m *ResponseInitChain) XXX_Size() int { return m.Size() @@ -1915,7 +1441,7 @@ type ResponseQuery struct { 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 *merkle.Proof `protobuf:"bytes,8,opt,name=proof" json:"proof,omitempty"` + Proof *merkle.Proof `protobuf:"bytes,8,opt,name=proof,proto3" json:"proof,omitempty"` Height int64 `protobuf:"varint,9,opt,name=height,proto3" json:"height,omitempty"` Codespace string `protobuf:"bytes,10,opt,name=codespace,proto3" json:"codespace,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` @@ -1927,7 +1453,7 @@ func (m *ResponseQuery) Reset() { *m = ResponseQuery{} } func (m *ResponseQuery) String() string { return proto.CompactTextString(m) } func (*ResponseQuery) ProtoMessage() {} func (*ResponseQuery) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{19} + return fileDescriptor_9f1eaa49c51fa1ac, []int{19} } func (m *ResponseQuery) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1937,15 +1463,15 @@ func (m *ResponseQuery) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_ResponseQuery.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseQuery) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseQuery.Merge(dst, src) +func (m *ResponseQuery) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseQuery.Merge(m, src) } func (m *ResponseQuery) XXX_Size() int { return m.Size() @@ -2020,7 +1546,7 @@ func (m *ResponseQuery) GetCodespace() string { } type ResponseBeginBlock struct { - Events []Event `protobuf:"bytes,1,rep,name=events" json:"events,omitempty"` + Events []Event `protobuf:"bytes,1,rep,name=events,proto3" json:"events,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2030,7 +1556,7 @@ func (m *ResponseBeginBlock) Reset() { *m = ResponseBeginBlock{} } func (m *ResponseBeginBlock) String() string { return proto.CompactTextString(m) } func (*ResponseBeginBlock) ProtoMessage() {} func (*ResponseBeginBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{20} + return fileDescriptor_9f1eaa49c51fa1ac, []int{20} } func (m *ResponseBeginBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2040,15 +1566,15 @@ func (m *ResponseBeginBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, return xxx_messageInfo_ResponseBeginBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseBeginBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseBeginBlock.Merge(dst, src) +func (m *ResponseBeginBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseBeginBlock.Merge(m, src) } func (m *ResponseBeginBlock) XXX_Size() int { return m.Size() @@ -2073,7 +1599,7 @@ type ResponseCheckTx struct { 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"` - Events []Event `protobuf:"bytes,7,rep,name=events" json:"events,omitempty"` + Events []Event `protobuf:"bytes,7,rep,name=events,proto3" json:"events,omitempty"` Codespace string `protobuf:"bytes,8,opt,name=codespace,proto3" json:"codespace,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2084,7 +1610,7 @@ func (m *ResponseCheckTx) Reset() { *m = ResponseCheckTx{} } func (m *ResponseCheckTx) String() string { return proto.CompactTextString(m) } func (*ResponseCheckTx) ProtoMessage() {} func (*ResponseCheckTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{21} + return fileDescriptor_9f1eaa49c51fa1ac, []int{21} } func (m *ResponseCheckTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2094,15 +1620,15 @@ func (m *ResponseCheckTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ResponseCheckTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseCheckTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseCheckTx.Merge(dst, src) +func (m *ResponseCheckTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseCheckTx.Merge(m, src) } func (m *ResponseCheckTx) XXX_Size() int { return m.Size() @@ -2176,7 +1702,7 @@ type ResponseDeliverTx struct { 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"` - Events []Event `protobuf:"bytes,7,rep,name=events" json:"events,omitempty"` + Events []Event `protobuf:"bytes,7,rep,name=events,proto3" json:"events,omitempty"` Codespace string `protobuf:"bytes,8,opt,name=codespace,proto3" json:"codespace,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -2187,7 +1713,7 @@ func (m *ResponseDeliverTx) Reset() { *m = ResponseDeliverTx{} } func (m *ResponseDeliverTx) String() string { return proto.CompactTextString(m) } func (*ResponseDeliverTx) ProtoMessage() {} func (*ResponseDeliverTx) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{22} + return fileDescriptor_9f1eaa49c51fa1ac, []int{22} } func (m *ResponseDeliverTx) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2197,15 +1723,15 @@ func (m *ResponseDeliverTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return xxx_messageInfo_ResponseDeliverTx.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseDeliverTx) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseDeliverTx.Merge(dst, src) +func (m *ResponseDeliverTx) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseDeliverTx.Merge(m, src) } func (m *ResponseDeliverTx) XXX_Size() int { return m.Size() @@ -2273,9 +1799,9 @@ func (m *ResponseDeliverTx) GetCodespace() string { } type ResponseEndBlock struct { - ValidatorUpdates []ValidatorUpdate `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"` - Events []Event `protobuf:"bytes,3,rep,name=events" json:"events,omitempty"` + ValidatorUpdates []ValidatorUpdate `protobuf:"bytes,1,rep,name=validator_updates,json=validatorUpdates,proto3" json:"validator_updates"` + ConsensusParamUpdates *ConsensusParams `protobuf:"bytes,2,opt,name=consensus_param_updates,json=consensusParamUpdates,proto3" json:"consensus_param_updates,omitempty"` + Events []Event `protobuf:"bytes,3,rep,name=events,proto3" json:"events,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2285,7 +1811,7 @@ func (m *ResponseEndBlock) Reset() { *m = ResponseEndBlock{} } func (m *ResponseEndBlock) String() string { return proto.CompactTextString(m) } func (*ResponseEndBlock) ProtoMessage() {} func (*ResponseEndBlock) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{23} + return fileDescriptor_9f1eaa49c51fa1ac, []int{23} } func (m *ResponseEndBlock) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2295,15 +1821,15 @@ func (m *ResponseEndBlock) XXX_Marshal(b []byte, deterministic bool) ([]byte, er return xxx_messageInfo_ResponseEndBlock.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseEndBlock) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseEndBlock.Merge(dst, src) +func (m *ResponseEndBlock) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseEndBlock.Merge(m, src) } func (m *ResponseEndBlock) XXX_Size() int { return m.Size() @@ -2347,7 +1873,7 @@ func (m *ResponseCommit) Reset() { *m = ResponseCommit{} } func (m *ResponseCommit) String() string { return proto.CompactTextString(m) } func (*ResponseCommit) ProtoMessage() {} func (*ResponseCommit) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{24} + return fileDescriptor_9f1eaa49c51fa1ac, []int{24} } func (m *ResponseCommit) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2357,15 +1883,15 @@ func (m *ResponseCommit) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_ResponseCommit.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ResponseCommit) XXX_Merge(src proto.Message) { - xxx_messageInfo_ResponseCommit.Merge(dst, src) +func (m *ResponseCommit) XXX_Merge(src proto.Message) { + xxx_messageInfo_ResponseCommit.Merge(m, src) } func (m *ResponseCommit) XXX_Size() int { return m.Size() @@ -2386,9 +1912,9 @@ func (m *ResponseCommit) GetData() []byte { // ConsensusParams contains all consensus-relevant parameters // that can be adjusted by the abci app type ConsensusParams struct { - Block *BlockParams `protobuf:"bytes,1,opt,name=block" json:"block,omitempty"` - Evidence *EvidenceParams `protobuf:"bytes,2,opt,name=evidence" json:"evidence,omitempty"` - Validator *ValidatorParams `protobuf:"bytes,3,opt,name=validator" json:"validator,omitempty"` + Block *BlockParams `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` + Evidence *EvidenceParams `protobuf:"bytes,2,opt,name=evidence,proto3" json:"evidence,omitempty"` + Validator *ValidatorParams `protobuf:"bytes,3,opt,name=validator,proto3" json:"validator,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2398,7 +1924,7 @@ func (m *ConsensusParams) Reset() { *m = ConsensusParams{} } func (m *ConsensusParams) String() string { return proto.CompactTextString(m) } func (*ConsensusParams) ProtoMessage() {} func (*ConsensusParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{25} + return fileDescriptor_9f1eaa49c51fa1ac, []int{25} } func (m *ConsensusParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2408,15 +1934,15 @@ func (m *ConsensusParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ConsensusParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ConsensusParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ConsensusParams.Merge(dst, src) +func (m *ConsensusParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConsensusParams.Merge(m, src) } func (m *ConsensusParams) XXX_Size() int { return m.Size() @@ -2463,7 +1989,7 @@ func (m *BlockParams) Reset() { *m = BlockParams{} } func (m *BlockParams) String() string { return proto.CompactTextString(m) } func (*BlockParams) ProtoMessage() {} func (*BlockParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{26} + return fileDescriptor_9f1eaa49c51fa1ac, []int{26} } func (m *BlockParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2473,15 +1999,15 @@ func (m *BlockParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return xxx_messageInfo_BlockParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *BlockParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockParams.Merge(dst, src) +func (m *BlockParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockParams.Merge(m, src) } func (m *BlockParams) XXX_Size() int { return m.Size() @@ -2519,7 +2045,7 @@ func (m *EvidenceParams) Reset() { *m = EvidenceParams{} } func (m *EvidenceParams) String() string { return proto.CompactTextString(m) } func (*EvidenceParams) ProtoMessage() {} func (*EvidenceParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{27} + return fileDescriptor_9f1eaa49c51fa1ac, []int{27} } func (m *EvidenceParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2529,15 +2055,15 @@ func (m *EvidenceParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_EvidenceParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *EvidenceParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_EvidenceParams.Merge(dst, src) +func (m *EvidenceParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_EvidenceParams.Merge(m, src) } func (m *EvidenceParams) XXX_Size() int { return m.Size() @@ -2557,7 +2083,7 @@ func (m *EvidenceParams) GetMaxAge() int64 { // ValidatorParams contains limits on validators. type ValidatorParams struct { - PubKeyTypes []string `protobuf:"bytes,1,rep,name=pub_key_types,json=pubKeyTypes" json:"pub_key_types,omitempty"` + PubKeyTypes []string `protobuf:"bytes,1,rep,name=pub_key_types,json=pubKeyTypes,proto3" json:"pub_key_types,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2567,7 +2093,7 @@ func (m *ValidatorParams) Reset() { *m = ValidatorParams{} } func (m *ValidatorParams) String() string { return proto.CompactTextString(m) } func (*ValidatorParams) ProtoMessage() {} func (*ValidatorParams) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{28} + return fileDescriptor_9f1eaa49c51fa1ac, []int{28} } func (m *ValidatorParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2577,15 +2103,15 @@ func (m *ValidatorParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ValidatorParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ValidatorParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorParams.Merge(dst, src) +func (m *ValidatorParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorParams.Merge(m, src) } func (m *ValidatorParams) XXX_Size() int { return m.Size() @@ -2605,7 +2131,7 @@ func (m *ValidatorParams) GetPubKeyTypes() []string { type LastCommitInfo struct { Round int32 `protobuf:"varint,1,opt,name=round,proto3" json:"round,omitempty"` - Votes []VoteInfo `protobuf:"bytes,2,rep,name=votes" json:"votes"` + Votes []VoteInfo `protobuf:"bytes,2,rep,name=votes,proto3" json:"votes"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2615,7 +2141,7 @@ func (m *LastCommitInfo) Reset() { *m = LastCommitInfo{} } func (m *LastCommitInfo) String() string { return proto.CompactTextString(m) } func (*LastCommitInfo) ProtoMessage() {} func (*LastCommitInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{29} + return fileDescriptor_9f1eaa49c51fa1ac, []int{29} } func (m *LastCommitInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2625,15 +2151,15 @@ func (m *LastCommitInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, erro return xxx_messageInfo_LastCommitInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *LastCommitInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_LastCommitInfo.Merge(dst, src) +func (m *LastCommitInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_LastCommitInfo.Merge(m, src) } func (m *LastCommitInfo) XXX_Size() int { return m.Size() @@ -2660,7 +2186,7 @@ func (m *LastCommitInfo) GetVotes() []VoteInfo { type Event struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Attributes []common.KVPair `protobuf:"bytes,2,rep,name=attributes" json:"attributes,omitempty"` + Attributes []common.KVPair `protobuf:"bytes,2,rep,name=attributes,proto3" json:"attributes,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2670,7 +2196,7 @@ func (m *Event) Reset() { *m = Event{} } func (m *Event) String() string { return proto.CompactTextString(m) } func (*Event) ProtoMessage() {} func (*Event) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{30} + return fileDescriptor_9f1eaa49c51fa1ac, []int{30} } func (m *Event) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2680,15 +2206,15 @@ func (m *Event) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Event.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Event) XXX_Merge(src proto.Message) { - xxx_messageInfo_Event.Merge(dst, src) +func (m *Event) XXX_Merge(src proto.Message) { + xxx_messageInfo_Event.Merge(m, src) } func (m *Event) XXX_Size() int { return m.Size() @@ -2715,26 +2241,24 @@ func (m *Event) GetAttributes() []common.KVPair { type Header struct { // basic block info - Version Version `protobuf:"bytes,1,opt,name=version" json:"version"` - ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` - Time time.Time `protobuf:"bytes,4,opt,name=time,stdtime" json:"time"` - NumTxs int64 `protobuf:"varint,5,opt,name=num_txs,json=numTxs,proto3" json:"num_txs,omitempty"` - TotalTxs int64 `protobuf:"varint,6,opt,name=total_txs,json=totalTxs,proto3" json:"total_txs,omitempty"` + Version Version `protobuf:"bytes,1,opt,name=version,proto3" json:"version"` + ChainID string `protobuf:"bytes,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` + Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` // prev block info - LastBlockId BlockID `protobuf:"bytes,7,opt,name=last_block_id,json=lastBlockId" json:"last_block_id"` + LastBlockId BlockID `protobuf:"bytes,5,opt,name=last_block_id,json=lastBlockId,proto3" json:"last_block_id"` // hashes of block data - LastCommitHash []byte `protobuf:"bytes,8,opt,name=last_commit_hash,json=lastCommitHash,proto3" json:"last_commit_hash,omitempty"` - DataHash []byte `protobuf:"bytes,9,opt,name=data_hash,json=dataHash,proto3" json:"data_hash,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"` // hashes from the app output from the prev block - ValidatorsHash []byte `protobuf:"bytes,10,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` - NextValidatorsHash []byte `protobuf:"bytes,11,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` - ConsensusHash []byte `protobuf:"bytes,12,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` - AppHash []byte `protobuf:"bytes,13,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` - LastResultsHash []byte `protobuf:"bytes,14,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` + ValidatorsHash []byte `protobuf:"bytes,8,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` + NextValidatorsHash []byte `protobuf:"bytes,9,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` + ConsensusHash []byte `protobuf:"bytes,10,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` + AppHash []byte `protobuf:"bytes,11,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + LastResultsHash []byte `protobuf:"bytes,12,opt,name=last_results_hash,json=lastResultsHash,proto3" json:"last_results_hash,omitempty"` // consensus info - EvidenceHash []byte `protobuf:"bytes,15,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` - ProposerAddress []byte `protobuf:"bytes,16,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` + EvidenceHash []byte `protobuf:"bytes,13,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` + ProposerAddress []byte `protobuf:"bytes,14,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposer_address,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2744,7 +2268,7 @@ func (m *Header) Reset() { *m = Header{} } func (m *Header) String() string { return proto.CompactTextString(m) } func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{31} + return fileDescriptor_9f1eaa49c51fa1ac, []int{31} } func (m *Header) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2754,15 +2278,15 @@ func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Header.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Header) XXX_Merge(src proto.Message) { - xxx_messageInfo_Header.Merge(dst, src) +func (m *Header) XXX_Merge(src proto.Message) { + xxx_messageInfo_Header.Merge(m, src) } func (m *Header) XXX_Size() int { return m.Size() @@ -2801,20 +2325,6 @@ func (m *Header) GetTime() time.Time { return time.Time{} } -func (m *Header) GetNumTxs() int64 { - if m != nil { - return m.NumTxs - } - return 0 -} - -func (m *Header) GetTotalTxs() int64 { - if m != nil { - return m.TotalTxs - } - return 0 -} - func (m *Header) GetLastBlockId() BlockID { if m != nil { return m.LastBlockId @@ -2897,7 +2407,7 @@ func (m *Version) Reset() { *m = Version{} } func (m *Version) String() string { return proto.CompactTextString(m) } func (*Version) ProtoMessage() {} func (*Version) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{32} + return fileDescriptor_9f1eaa49c51fa1ac, []int{32} } func (m *Version) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2907,15 +2417,15 @@ func (m *Version) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Version.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Version) XXX_Merge(src proto.Message) { - xxx_messageInfo_Version.Merge(dst, src) +func (m *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(m, src) } func (m *Version) XXX_Size() int { return m.Size() @@ -2942,7 +2452,7 @@ func (m *Version) GetApp() uint64 { type BlockID struct { Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` - PartsHeader PartSetHeader `protobuf:"bytes,2,opt,name=parts_header,json=partsHeader" json:"parts_header"` + PartsHeader PartSetHeader `protobuf:"bytes,2,opt,name=parts_header,json=partsHeader,proto3" json:"parts_header"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -2952,7 +2462,7 @@ func (m *BlockID) Reset() { *m = BlockID{} } func (m *BlockID) String() string { return proto.CompactTextString(m) } func (*BlockID) ProtoMessage() {} func (*BlockID) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{33} + return fileDescriptor_9f1eaa49c51fa1ac, []int{33} } func (m *BlockID) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2962,15 +2472,15 @@ func (m *BlockID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_BlockID.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *BlockID) XXX_Merge(src proto.Message) { - xxx_messageInfo_BlockID.Merge(dst, src) +func (m *BlockID) XXX_Merge(src proto.Message) { + xxx_messageInfo_BlockID.Merge(m, src) } func (m *BlockID) XXX_Size() int { return m.Size() @@ -3007,7 +2517,7 @@ func (m *PartSetHeader) Reset() { *m = PartSetHeader{} } func (m *PartSetHeader) String() string { return proto.CompactTextString(m) } func (*PartSetHeader) ProtoMessage() {} func (*PartSetHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{34} + return fileDescriptor_9f1eaa49c51fa1ac, []int{34} } func (m *PartSetHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3017,15 +2527,15 @@ func (m *PartSetHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error return xxx_messageInfo_PartSetHeader.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *PartSetHeader) XXX_Merge(src proto.Message) { - xxx_messageInfo_PartSetHeader.Merge(dst, src) +func (m *PartSetHeader) XXX_Merge(src proto.Message) { + xxx_messageInfo_PartSetHeader.Merge(m, src) } func (m *PartSetHeader) XXX_Size() int { return m.Size() @@ -3053,7 +2563,7 @@ func (m *PartSetHeader) GetHash() []byte { // Validator type Validator struct { Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"` - // PubKey pub_key = 2 [(gogoproto.nullable)=false]; + //PubKey pub_key = 2 [(gogoproto.nullable)=false]; Power int64 `protobuf:"varint,3,opt,name=power,proto3" json:"power,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3064,7 +2574,7 @@ func (m *Validator) Reset() { *m = Validator{} } func (m *Validator) String() string { return proto.CompactTextString(m) } func (*Validator) ProtoMessage() {} func (*Validator) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{35} + return fileDescriptor_9f1eaa49c51fa1ac, []int{35} } func (m *Validator) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3074,15 +2584,15 @@ func (m *Validator) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Validator.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Validator) XXX_Merge(src proto.Message) { - xxx_messageInfo_Validator.Merge(dst, src) +func (m *Validator) XXX_Merge(src proto.Message) { + xxx_messageInfo_Validator.Merge(m, src) } func (m *Validator) XXX_Size() int { return m.Size() @@ -3109,7 +2619,7 @@ func (m *Validator) GetPower() int64 { // ValidatorUpdate type ValidatorUpdate struct { - PubKey PubKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey" json:"pub_key"` + PubKey PubKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key"` Power int64 `protobuf:"varint,2,opt,name=power,proto3" json:"power,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3120,7 +2630,7 @@ func (m *ValidatorUpdate) Reset() { *m = ValidatorUpdate{} } func (m *ValidatorUpdate) String() string { return proto.CompactTextString(m) } func (*ValidatorUpdate) ProtoMessage() {} func (*ValidatorUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{36} + return fileDescriptor_9f1eaa49c51fa1ac, []int{36} } func (m *ValidatorUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3130,15 +2640,15 @@ func (m *ValidatorUpdate) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return xxx_messageInfo_ValidatorUpdate.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ValidatorUpdate) XXX_Merge(src proto.Message) { - xxx_messageInfo_ValidatorUpdate.Merge(dst, src) +func (m *ValidatorUpdate) XXX_Merge(src proto.Message) { + xxx_messageInfo_ValidatorUpdate.Merge(m, src) } func (m *ValidatorUpdate) XXX_Size() int { return m.Size() @@ -3165,7 +2675,7 @@ func (m *ValidatorUpdate) GetPower() int64 { // VoteInfo type VoteInfo struct { - Validator Validator `protobuf:"bytes,1,opt,name=validator" json:"validator"` + Validator Validator `protobuf:"bytes,1,opt,name=validator,proto3" json:"validator"` SignedLastBlock bool `protobuf:"varint,2,opt,name=signed_last_block,json=signedLastBlock,proto3" json:"signed_last_block,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3176,7 +2686,7 @@ func (m *VoteInfo) Reset() { *m = VoteInfo{} } func (m *VoteInfo) String() string { return proto.CompactTextString(m) } func (*VoteInfo) ProtoMessage() {} func (*VoteInfo) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{37} + return fileDescriptor_9f1eaa49c51fa1ac, []int{37} } func (m *VoteInfo) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3186,15 +2696,15 @@ func (m *VoteInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_VoteInfo.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *VoteInfo) XXX_Merge(src proto.Message) { - xxx_messageInfo_VoteInfo.Merge(dst, src) +func (m *VoteInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoteInfo.Merge(m, src) } func (m *VoteInfo) XXX_Size() int { return m.Size() @@ -3231,7 +2741,7 @@ func (m *PubKey) Reset() { *m = PubKey{} } func (m *PubKey) String() string { return proto.CompactTextString(m) } func (*PubKey) ProtoMessage() {} func (*PubKey) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{38} + return fileDescriptor_9f1eaa49c51fa1ac, []int{38} } func (m *PubKey) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3241,15 +2751,15 @@ func (m *PubKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_PubKey.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *PubKey) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKey.Merge(dst, src) +func (m *PubKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_PubKey.Merge(m, src) } func (m *PubKey) XXX_Size() int { return m.Size() @@ -3276,9 +2786,9 @@ func (m *PubKey) GetData() []byte { type Evidence struct { Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` - Validator Validator `protobuf:"bytes,2,opt,name=validator" json:"validator"` + Validator Validator `protobuf:"bytes,2,opt,name=validator,proto3" json:"validator"` Height int64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"` - Time time.Time `protobuf:"bytes,4,opt,name=time,stdtime" json:"time"` + Time time.Time `protobuf:"bytes,4,opt,name=time,proto3,stdtime" json:"time"` TotalVotingPower int64 `protobuf:"varint,5,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` @@ -3289,7 +2799,7 @@ func (m *Evidence) Reset() { *m = Evidence{} } func (m *Evidence) String() string { return proto.CompactTextString(m) } func (*Evidence) ProtoMessage() {} func (*Evidence) Descriptor() ([]byte, []int) { - return fileDescriptor_types_30d8160a6576aafe, []int{39} + return fileDescriptor_9f1eaa49c51fa1ac, []int{39} } func (m *Evidence) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -3299,15 +2809,15 @@ func (m *Evidence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Evidence.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Evidence) XXX_Merge(src proto.Message) { - xxx_messageInfo_Evidence.Merge(dst, src) +func (m *Evidence) XXX_Merge(src proto.Message) { + xxx_messageInfo_Evidence.Merge(m, src) } func (m *Evidence) XXX_Size() int { return m.Size() @@ -3354,6 +2864,8 @@ func (m *Evidence) GetTotalVotingPower() int64 { } func init() { + proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) + golang_proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) proto.RegisterType((*Request)(nil), "types.Request") golang_proto.RegisterType((*Request)(nil), "types.Request") proto.RegisterType((*RequestEcho)(nil), "types.RequestEcho") @@ -3434,9 +2946,156 @@ func init() { golang_proto.RegisterType((*PubKey)(nil), "types.PubKey") proto.RegisterType((*Evidence)(nil), "types.Evidence") golang_proto.RegisterType((*Evidence)(nil), "types.Evidence") - proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) - golang_proto.RegisterEnum("types.CheckTxType", CheckTxType_name, CheckTxType_value) } + +func init() { proto.RegisterFile("abci/types/types.proto", fileDescriptor_9f1eaa49c51fa1ac) } +func init() { golang_proto.RegisterFile("abci/types/types.proto", fileDescriptor_9f1eaa49c51fa1ac) } + +var fileDescriptor_9f1eaa49c51fa1ac = []byte{ + // 2254 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x4f, 0x73, 0x1b, 0x49, + 0x15, 0xf7, 0xe8, 0x8f, 0xa5, 0x79, 0xb2, 0xfe, 0xa4, 0xe3, 0x24, 0x8a, 0x08, 0x76, 0x6a, 0x02, + 0x59, 0x7b, 0x37, 0x2b, 0xef, 0x7a, 0x09, 0xe5, 0x90, 0x65, 0xab, 0xac, 0x24, 0x60, 0xd7, 0x86, + 0xc5, 0x4c, 0x12, 0x73, 0xa1, 0x6a, 0xaa, 0xa5, 0xe9, 0x48, 0x53, 0x91, 0x66, 0x66, 0x67, 0x5a, + 0x8e, 0xc4, 0x67, 0xd8, 0xc3, 0x1e, 0xf8, 0x08, 0x1c, 0xf8, 0x08, 0x7b, 0xe4, 0x44, 0xed, 0x81, + 0x03, 0x07, 0xce, 0x01, 0x4c, 0x71, 0xa1, 0x8a, 0x33, 0x70, 0xa3, 0xfa, 0x75, 0xcf, 0x5f, 0x8f, + 0xc2, 0x6e, 0xe0, 0xb6, 0x17, 0x7b, 0xba, 0xfb, 0xf7, 0x5a, 0xfd, 0x5e, 0xbf, 0xf7, 0x7e, 0xef, + 0x35, 0x5c, 0xa5, 0xc3, 0x91, 0xb3, 0xc7, 0x97, 0x3e, 0x0b, 0xe5, 0xdf, 0xbe, 0x1f, 0x78, 0xdc, + 0x23, 0x55, 0x1c, 0xf4, 0xde, 0x1d, 0x3b, 0x7c, 0x32, 0x1f, 0xf6, 0x47, 0xde, 0x6c, 0x6f, 0xec, + 0x8d, 0xbd, 0x3d, 0x5c, 0x1d, 0xce, 0x9f, 0xe3, 0x08, 0x07, 0xf8, 0x25, 0xa5, 0x7a, 0xf7, 0x53, + 0x70, 0xce, 0x5c, 0x9b, 0x05, 0x33, 0xc7, 0xe5, 0xe9, 0xcf, 0x51, 0xb0, 0xf4, 0xb9, 0xb7, 0x37, + 0x63, 0xc1, 0x8b, 0x29, 0x53, 0xff, 0x94, 0xf0, 0xc1, 0x7f, 0x15, 0x9e, 0x3a, 0xc3, 0x70, 0x6f, + 0xe4, 0xcd, 0x66, 0x9e, 0x9b, 0x3e, 0x6c, 0x6f, 0x7b, 0xec, 0x79, 0xe3, 0x29, 0x4b, 0x0e, 0xc7, + 0x9d, 0x19, 0x0b, 0x39, 0x9d, 0xf9, 0x12, 0x60, 0xfc, 0xae, 0x02, 0x35, 0x93, 0x7d, 0x3a, 0x67, + 0x21, 0x27, 0x3b, 0x50, 0x61, 0xa3, 0x89, 0xd7, 0x2d, 0xdd, 0xd4, 0x76, 0x1a, 0xfb, 0xa4, 0x2f, + 0x37, 0x52, 0xab, 0x8f, 0x46, 0x13, 0xef, 0x68, 0xcd, 0x44, 0x04, 0x79, 0x07, 0xaa, 0xcf, 0xa7, + 0xf3, 0x70, 0xd2, 0x2d, 0x23, 0xf4, 0x72, 0x16, 0xfa, 0x23, 0xb1, 0x74, 0xb4, 0x66, 0x4a, 0x8c, + 0xd8, 0xd6, 0x71, 0x9f, 0x7b, 0xdd, 0x4a, 0xd1, 0xb6, 0xc7, 0xee, 0x73, 0xdc, 0x56, 0x20, 0xc8, + 0x01, 0x40, 0xc8, 0xb8, 0xe5, 0xf9, 0xdc, 0xf1, 0xdc, 0x6e, 0x15, 0xf1, 0xd7, 0xb2, 0xf8, 0x27, + 0x8c, 0xff, 0x14, 0x97, 0x8f, 0xd6, 0x4c, 0x3d, 0x8c, 0x06, 0x42, 0xd2, 0x71, 0x1d, 0x6e, 0x8d, + 0x26, 0xd4, 0x71, 0xbb, 0xeb, 0x45, 0x92, 0xc7, 0xae, 0xc3, 0x1f, 0x88, 0x65, 0x21, 0xe9, 0x44, + 0x03, 0xa1, 0xca, 0xa7, 0x73, 0x16, 0x2c, 0xbb, 0xb5, 0x22, 0x55, 0x7e, 0x26, 0x96, 0x84, 0x2a, + 0x88, 0x21, 0xf7, 0xa1, 0x31, 0x64, 0x63, 0xc7, 0xb5, 0x86, 0x53, 0x6f, 0xf4, 0xa2, 0x5b, 0x47, + 0x91, 0x6e, 0x56, 0x64, 0x20, 0x00, 0x03, 0xb1, 0x7e, 0xb4, 0x66, 0xc2, 0x30, 0x1e, 0x91, 0x7d, + 0xa8, 0x8f, 0x26, 0x6c, 0xf4, 0xc2, 0xe2, 0x8b, 0xae, 0x8e, 0x92, 0x57, 0xb2, 0x92, 0x0f, 0xc4, + 0xea, 0xd3, 0xc5, 0xd1, 0x9a, 0x59, 0x1b, 0xc9, 0x4f, 0xa1, 0x97, 0xcd, 0xa6, 0xce, 0x19, 0x0b, + 0x84, 0xd4, 0xe5, 0x22, 0xbd, 0x1e, 0xca, 0x75, 0x94, 0xd3, 0xed, 0x68, 0x40, 0xee, 0x82, 0xce, + 0x5c, 0x5b, 0x1d, 0xb4, 0x81, 0x82, 0x57, 0x73, 0x37, 0xea, 0xda, 0xd1, 0x31, 0xeb, 0x4c, 0x7d, + 0x93, 0x3e, 0xac, 0x0b, 0x37, 0x72, 0x78, 0x77, 0x03, 0x65, 0x36, 0x73, 0x47, 0xc4, 0xb5, 0xa3, + 0x35, 0x53, 0xa1, 0x06, 0x35, 0xa8, 0x9e, 0xd1, 0xe9, 0x9c, 0x19, 0x6f, 0x41, 0x23, 0xe5, 0x29, + 0xa4, 0x0b, 0xb5, 0x19, 0x0b, 0x43, 0x3a, 0x66, 0x5d, 0xed, 0xa6, 0xb6, 0xa3, 0x9b, 0xd1, 0xd0, + 0x68, 0xc1, 0x46, 0xda, 0x4f, 0x8c, 0x59, 0x2c, 0x28, 0x7c, 0x41, 0x08, 0x9e, 0xb1, 0x20, 0x14, + 0x0e, 0xa0, 0x04, 0xd5, 0x90, 0xdc, 0x82, 0x26, 0x6a, 0x63, 0x45, 0xeb, 0xc2, 0x4f, 0x2b, 0xe6, + 0x06, 0x4e, 0x9e, 0x2a, 0xd0, 0x36, 0x34, 0xfc, 0x7d, 0x3f, 0x86, 0x94, 0x11, 0x02, 0xfe, 0xbe, + 0xaf, 0x00, 0xc6, 0x0f, 0xa0, 0x93, 0x77, 0x25, 0xd2, 0x81, 0xf2, 0x0b, 0xb6, 0x54, 0xbf, 0x27, + 0x3e, 0xc9, 0xa6, 0x52, 0x0b, 0x7f, 0x43, 0x37, 0x95, 0x8e, 0x9f, 0x97, 0x62, 0xe1, 0xd8, 0x9b, + 0xc8, 0x01, 0x54, 0x44, 0x50, 0xa1, 0x74, 0x63, 0xbf, 0xd7, 0x97, 0x11, 0xd7, 0x8f, 0x22, 0xae, + 0xff, 0x34, 0x8a, 0xb8, 0x41, 0xfd, 0xcb, 0x57, 0xdb, 0x6b, 0x9f, 0xff, 0x69, 0x5b, 0x33, 0x51, + 0x82, 0x5c, 0x17, 0x0e, 0x41, 0x1d, 0xd7, 0x72, 0x6c, 0xf5, 0x3b, 0x35, 0x1c, 0x1f, 0xdb, 0xe4, + 0x10, 0x3a, 0x23, 0xcf, 0x0d, 0x99, 0x1b, 0xce, 0x43, 0xcb, 0xa7, 0x01, 0x9d, 0x85, 0x2a, 0xd6, + 0xa2, 0x4b, 0x7c, 0x10, 0x2d, 0x9f, 0xe0, 0xaa, 0xd9, 0x1e, 0x65, 0x27, 0xc8, 0x87, 0x00, 0x67, + 0x74, 0xea, 0xd8, 0x94, 0x7b, 0x41, 0xd8, 0xad, 0xdc, 0x2c, 0xa7, 0x84, 0x4f, 0xa3, 0x85, 0x67, + 0xbe, 0x4d, 0x39, 0x1b, 0x54, 0xc4, 0xc9, 0xcc, 0x14, 0x9e, 0xdc, 0x86, 0x36, 0xf5, 0x7d, 0x2b, + 0xe4, 0x94, 0x33, 0x6b, 0xb8, 0xe4, 0x2c, 0xc4, 0x78, 0xdc, 0x30, 0x9b, 0xd4, 0xf7, 0x9f, 0x88, + 0xd9, 0x81, 0x98, 0x34, 0xec, 0xf8, 0x36, 0x31, 0x54, 0x08, 0x81, 0x8a, 0x4d, 0x39, 0x45, 0x6b, + 0x6c, 0x98, 0xf8, 0x2d, 0xe6, 0x7c, 0xca, 0x27, 0x4a, 0x47, 0xfc, 0x26, 0x57, 0x61, 0x7d, 0xc2, + 0x9c, 0xf1, 0x84, 0xa3, 0x5a, 0x65, 0x53, 0x8d, 0x84, 0xe1, 0xfd, 0xc0, 0x3b, 0x63, 0x98, 0x2d, + 0xea, 0xa6, 0x1c, 0x18, 0x7f, 0xd3, 0xe0, 0xd2, 0x85, 0xf0, 0x12, 0xfb, 0x4e, 0x68, 0x38, 0x89, + 0x7e, 0x4b, 0x7c, 0x93, 0x77, 0xc4, 0xbe, 0xd4, 0x66, 0x81, 0xca, 0x62, 0x4d, 0xa5, 0xf1, 0x11, + 0x4e, 0x2a, 0x45, 0x15, 0x84, 0x3c, 0x82, 0xce, 0x94, 0x86, 0xdc, 0x92, 0xbe, 0x6c, 0x61, 0x96, + 0x2a, 0x67, 0x22, 0xf3, 0x31, 0x8d, 0x7c, 0x5e, 0x38, 0xa7, 0x12, 0x6f, 0x4d, 0x33, 0xb3, 0xe4, + 0x08, 0x36, 0x87, 0xcb, 0x5f, 0x52, 0x97, 0x3b, 0x2e, 0xb3, 0x2e, 0xd8, 0xbc, 0xad, 0xb6, 0x7a, + 0x74, 0xe6, 0xd8, 0xcc, 0x1d, 0x45, 0xc6, 0xbe, 0x1c, 0x8b, 0xc4, 0x97, 0x11, 0x1a, 0x47, 0xd0, + 0xca, 0xe6, 0x02, 0xd2, 0x82, 0x12, 0x5f, 0x28, 0x0d, 0x4b, 0x7c, 0x41, 0x6e, 0x43, 0x45, 0x6c, + 0x87, 0xda, 0xb5, 0xe2, 0x64, 0xaa, 0xd0, 0x4f, 0x97, 0x3e, 0x33, 0x71, 0xdd, 0x30, 0x62, 0x4f, + 0x8d, 0xf3, 0x43, 0x7e, 0x2f, 0x63, 0x17, 0xda, 0xb9, 0x54, 0x90, 0xba, 0x16, 0x2d, 0x7d, 0x2d, + 0x46, 0x1b, 0x9a, 0x99, 0x0c, 0x60, 0x7c, 0x56, 0x85, 0xba, 0xc9, 0x42, 0x5f, 0x38, 0x1d, 0x39, + 0x00, 0x9d, 0x2d, 0x46, 0x4c, 0xa6, 0x6d, 0x2d, 0x97, 0x14, 0x25, 0xe6, 0x51, 0xb4, 0x2e, 0xb2, + 0x54, 0x0c, 0x26, 0xbb, 0x19, 0xca, 0xb9, 0x9c, 0x17, 0x4a, 0x73, 0xce, 0x9d, 0x2c, 0xe7, 0x6c, + 0xe6, 0xb0, 0x39, 0xd2, 0xd9, 0xcd, 0x90, 0x4e, 0x7e, 0xe3, 0x0c, 0xeb, 0xdc, 0x2b, 0x60, 0x9d, + 0xfc, 0xf1, 0x57, 0xd0, 0xce, 0xbd, 0x02, 0xda, 0xe9, 0x5e, 0xf8, 0xad, 0x42, 0xde, 0xb9, 0x93, + 0xe5, 0x9d, 0xbc, 0x3a, 0x39, 0xe2, 0xf9, 0xb0, 0x88, 0x78, 0xae, 0xe7, 0x64, 0x56, 0x32, 0xcf, + 0x07, 0x17, 0x98, 0xe7, 0x6a, 0x4e, 0xb4, 0x80, 0x7a, 0xee, 0x65, 0xa8, 0x07, 0x0a, 0x75, 0x5b, + 0xc1, 0x3d, 0xdf, 0xbf, 0xc8, 0x3d, 0xd7, 0xf2, 0x57, 0x5b, 0x44, 0x3e, 0x7b, 0x39, 0xf2, 0xb9, + 0x92, 0x3f, 0xe5, 0x4a, 0xf6, 0xd9, 0x15, 0xf9, 0x21, 0xe7, 0x69, 0x22, 0x97, 0xb0, 0x20, 0xf0, + 0x02, 0x95, 0xd8, 0xe5, 0xc0, 0xd8, 0x11, 0x19, 0x2b, 0xf1, 0xaf, 0xd7, 0x30, 0x15, 0x3a, 0x7d, + 0xca, 0xbb, 0x8c, 0x2f, 0xb4, 0x44, 0x16, 0x23, 0x3f, 0x9d, 0xed, 0x74, 0x95, 0xed, 0x52, 0x04, + 0x56, 0xca, 0x12, 0xd8, 0x36, 0x34, 0x44, 0x4e, 0xcd, 0x71, 0x13, 0xf5, 0x23, 0x6e, 0x22, 0x6f, + 0xc3, 0x25, 0xcc, 0x47, 0x92, 0xe6, 0x54, 0x20, 0x56, 0x30, 0x10, 0xdb, 0x62, 0x41, 0x5a, 0x4c, + 0x26, 0xca, 0x77, 0xe1, 0x72, 0x0a, 0x2b, 0xf6, 0xc5, 0x5c, 0x28, 0x93, 0x74, 0x27, 0x46, 0x1f, + 0xfa, 0xfe, 0x11, 0x0d, 0x27, 0xc6, 0x4f, 0x12, 0x03, 0x25, 0xbc, 0x47, 0xa0, 0x32, 0xf2, 0x6c, + 0xa9, 0x77, 0xd3, 0xc4, 0x6f, 0xc1, 0x85, 0x53, 0x6f, 0x8c, 0x87, 0xd3, 0x4d, 0xf1, 0x29, 0x50, + 0x71, 0x28, 0xe9, 0x32, 0x66, 0x8c, 0x5f, 0x69, 0xc9, 0x7e, 0x09, 0x15, 0x16, 0xb1, 0x96, 0xf6, + 0xbf, 0xb0, 0x56, 0xe9, 0xeb, 0xb1, 0x96, 0x71, 0xae, 0x25, 0x57, 0x16, 0xf3, 0xd1, 0x9b, 0xa9, + 0x28, 0xbc, 0xc7, 0x71, 0x6d, 0xb6, 0x40, 0x93, 0x96, 0x4d, 0x39, 0x88, 0x4a, 0x85, 0x75, 0x34, + 0x73, 0xb6, 0x54, 0xa8, 0xe1, 0x9c, 0x1c, 0x90, 0x5b, 0xc8, 0x63, 0xde, 0x73, 0x15, 0xaa, 0xcd, + 0xbe, 0x2a, 0xe8, 0x4f, 0xc4, 0xa4, 0x29, 0xd7, 0x52, 0xd9, 0x56, 0xcf, 0x90, 0xe0, 0x0d, 0xd0, + 0xc5, 0x41, 0x43, 0x9f, 0x8e, 0x18, 0x46, 0x9e, 0x6e, 0x26, 0x13, 0xc6, 0x53, 0x20, 0x17, 0x23, + 0x9e, 0x7c, 0x04, 0xeb, 0xec, 0x8c, 0xb9, 0x5c, 0x58, 0x5c, 0x18, 0x6d, 0x23, 0xa6, 0x1d, 0xe6, + 0xf2, 0x41, 0x57, 0x98, 0xea, 0xef, 0xaf, 0xb6, 0x3b, 0x12, 0x73, 0xc7, 0x9b, 0x39, 0x9c, 0xcd, + 0x7c, 0xbe, 0x34, 0x95, 0x94, 0xf1, 0x4f, 0x4d, 0xb0, 0x41, 0x26, 0x1b, 0x14, 0x1a, 0x2f, 0x72, + 0xf9, 0x52, 0x8a, 0xe0, 0xbf, 0x9a, 0x41, 0xbf, 0x0d, 0x30, 0xa6, 0xa1, 0xf5, 0x92, 0xba, 0x9c, + 0xd9, 0xca, 0xaa, 0xfa, 0x98, 0x86, 0x3f, 0xc7, 0x09, 0x51, 0x0d, 0x89, 0xe5, 0x79, 0xc8, 0x6c, + 0x34, 0x6f, 0xd9, 0xac, 0x8d, 0x69, 0xf8, 0x2c, 0x64, 0x76, 0x4a, 0xb7, 0xda, 0x9b, 0xe8, 0x96, + 0xb5, 0x67, 0x3d, 0x6f, 0xcf, 0x7f, 0xa7, 0x7c, 0x39, 0x21, 0xcb, 0x6f, 0x86, 0xee, 0xff, 0xd0, + 0x44, 0x9d, 0x90, 0x4d, 0xc9, 0xe4, 0x18, 0x2e, 0xc5, 0x31, 0x65, 0xcd, 0x31, 0xd6, 0x22, 0xaf, + 0x7a, 0x7d, 0x28, 0x76, 0xce, 0xb2, 0xd3, 0x21, 0xf9, 0x04, 0xae, 0xe5, 0x32, 0x42, 0xbc, 0x61, + 0xe9, 0xb5, 0x89, 0xe1, 0x4a, 0x36, 0x31, 0x44, 0xfb, 0x25, 0xd6, 0x28, 0xbf, 0x91, 0x97, 0x7f, + 0x47, 0x14, 0x58, 0x69, 0x32, 0x29, 0xba, 0x53, 0xe3, 0xd7, 0x1a, 0xb4, 0x73, 0x07, 0x22, 0x3b, + 0x50, 0x95, 0x7c, 0xa6, 0x65, 0xda, 0x58, 0xb4, 0x98, 0x3a, 0xb3, 0x04, 0x90, 0xf7, 0xa1, 0xce, + 0x54, 0xad, 0xa7, 0x94, 0xbc, 0x92, 0x2b, 0x01, 0x15, 0x3e, 0x86, 0x91, 0xef, 0x81, 0x1e, 0x9b, + 0x2e, 0x57, 0xe7, 0xc7, 0x96, 0x56, 0x42, 0x09, 0xd0, 0x78, 0x00, 0x8d, 0xd4, 0xcf, 0x93, 0x6f, + 0x81, 0x3e, 0xa3, 0x0b, 0x55, 0xac, 0xcb, 0xf2, 0xad, 0x3e, 0xa3, 0x0b, 0xac, 0xd3, 0xc9, 0x35, + 0xa8, 0x89, 0xc5, 0x31, 0x95, 0x86, 0x2f, 0x9b, 0xeb, 0x33, 0xba, 0xf8, 0x31, 0x0d, 0x8d, 0x5d, + 0x68, 0x65, 0x8f, 0x15, 0x41, 0x23, 0x42, 0x94, 0xd0, 0xc3, 0x31, 0x33, 0xee, 0x42, 0x3b, 0x77, + 0x1a, 0x62, 0x40, 0xd3, 0x9f, 0x0f, 0xad, 0x17, 0x6c, 0x69, 0xe1, 0x71, 0xd1, 0x4d, 0x74, 0xb3, + 0xe1, 0xcf, 0x87, 0x1f, 0xb3, 0xa5, 0xa8, 0x47, 0x43, 0xe3, 0x09, 0xb4, 0xb2, 0x65, 0xb4, 0x48, + 0x99, 0x81, 0x37, 0x77, 0x6d, 0xdc, 0xbf, 0x6a, 0xca, 0x81, 0xe8, 0xc4, 0xcf, 0x3c, 0xe9, 0x19, + 0xe9, 0xba, 0xf9, 0xd4, 0xe3, 0x2c, 0x55, 0x7c, 0x4b, 0x8c, 0xe1, 0x40, 0x15, 0xef, 0x5c, 0xdc, + 0x1f, 0x16, 0xc4, 0x8a, 0x82, 0xc5, 0x37, 0x79, 0x0c, 0x40, 0x39, 0x0f, 0x9c, 0xe1, 0x3c, 0xd9, + 0xae, 0xd5, 0x97, 0xcf, 0x23, 0xfd, 0x8f, 0x4f, 0x4f, 0xa8, 0x13, 0x0c, 0x6e, 0x28, 0x5f, 0xd9, + 0x4c, 0x90, 0x29, 0x7f, 0x49, 0xc9, 0x1b, 0xbf, 0xaf, 0xc0, 0xba, 0x6c, 0x1f, 0x48, 0x3f, 0xdb, + 0x9c, 0x8a, 0x5d, 0xd5, 0x21, 0xe5, 0xac, 0x3a, 0x63, 0xcc, 0xf8, 0xb7, 0xf3, 0x1d, 0xde, 0xa0, + 0x71, 0xfe, 0x6a, 0xbb, 0x86, 0x6c, 0x79, 0xfc, 0x30, 0x69, 0xf7, 0x56, 0x75, 0x43, 0x51, 0x6f, + 0x59, 0xf9, 0xda, 0xbd, 0xe5, 0x01, 0x34, 0x53, 0xe5, 0x81, 0x63, 0xab, 0xba, 0xb6, 0x95, 0x76, + 0xdb, 0xe3, 0x87, 0xea, 0xbc, 0x8d, 0xb8, 0x5c, 0x38, 0xb6, 0xc9, 0x4e, 0xb6, 0x29, 0xc2, 0xaa, + 0x42, 0xd2, 0x5d, 0xaa, 0xef, 0x11, 0x35, 0x85, 0x70, 0x38, 0x11, 0x2e, 0x12, 0x22, 0xd9, 0xaf, + 0x2e, 0x26, 0x70, 0xf1, 0x2d, 0x68, 0x27, 0xc4, 0x2c, 0x21, 0x75, 0xb9, 0x4b, 0x32, 0x8d, 0xc0, + 0xf7, 0x60, 0xd3, 0x65, 0x0b, 0x6e, 0xe5, 0xd1, 0x3a, 0xa2, 0x89, 0x58, 0x3b, 0xcd, 0x4a, 0x7c, + 0x17, 0x5a, 0x49, 0x52, 0x41, 0x2c, 0xc8, 0xd6, 0x34, 0x9e, 0x45, 0xd8, 0x75, 0xa8, 0xc7, 0x65, + 0x51, 0x03, 0x01, 0x35, 0x2a, 0xab, 0xa1, 0xb8, 0xd0, 0x0a, 0x58, 0x38, 0x9f, 0x72, 0xb5, 0xc9, + 0x06, 0x62, 0xb0, 0xd0, 0x32, 0xe5, 0x3c, 0x62, 0x6f, 0x41, 0x33, 0x8a, 0x53, 0x89, 0x6b, 0x22, + 0x6e, 0x23, 0x9a, 0x44, 0xd0, 0x2e, 0x74, 0xfc, 0xc0, 0xf3, 0xbd, 0x90, 0x05, 0x16, 0xb5, 0xed, + 0x80, 0x85, 0x61, 0xb7, 0x25, 0xf7, 0x8b, 0xe6, 0x0f, 0xe5, 0xb4, 0xf1, 0x3e, 0xd4, 0xa2, 0x7a, + 0x6f, 0x13, 0xaa, 0x83, 0x38, 0xa7, 0x54, 0x4c, 0x39, 0x10, 0x8c, 0x72, 0xe8, 0xfb, 0xea, 0x75, + 0x43, 0x7c, 0x1a, 0xbf, 0x80, 0x9a, 0xba, 0xb0, 0xc2, 0x9e, 0xf7, 0x87, 0xb0, 0xe1, 0xd3, 0x40, + 0xa8, 0x91, 0xee, 0x7c, 0xa3, 0x8e, 0xe2, 0x84, 0x06, 0xfc, 0x09, 0xe3, 0x99, 0x06, 0xb8, 0x81, + 0x78, 0x39, 0x65, 0xdc, 0x83, 0x66, 0x06, 0x23, 0x8e, 0xc5, 0x3d, 0x4e, 0xa7, 0x51, 0x78, 0xe2, + 0x20, 0xfe, 0xe5, 0x52, 0xf2, 0xcb, 0xc6, 0x7d, 0xd0, 0xe3, 0xbb, 0x11, 0x85, 0x6f, 0xa4, 0xba, + 0xa6, 0xcc, 0x2d, 0x87, 0xd8, 0xd4, 0x7b, 0x2f, 0x59, 0xa0, 0xbc, 0x5b, 0x0e, 0x8c, 0x67, 0xa9, + 0x74, 0x22, 0xf3, 0x3b, 0xb9, 0x03, 0x35, 0x95, 0x4e, 0x54, 0x7c, 0x45, 0xed, 0xfb, 0x09, 0xe6, + 0x93, 0xa8, 0x7d, 0x97, 0xd9, 0x25, 0xd9, 0xb6, 0x94, 0xde, 0x76, 0x0a, 0xf5, 0x28, 0x65, 0x64, + 0xf3, 0xaa, 0xdc, 0xb1, 0x93, 0xcf, 0xab, 0x6a, 0xd3, 0x04, 0x28, 0xbc, 0x23, 0x74, 0xc6, 0x2e, + 0xb3, 0xad, 0x24, 0x84, 0xf0, 0x37, 0xea, 0x66, 0x5b, 0x2e, 0x3c, 0x8e, 0xe2, 0xc5, 0x78, 0x0f, + 0xd6, 0xe5, 0xd9, 0x0a, 0x13, 0x51, 0x11, 0xb9, 0xfc, 0x51, 0x83, 0x7a, 0x94, 0x71, 0x0b, 0x85, + 0x32, 0x87, 0x2e, 0x7d, 0xd5, 0x43, 0xff, 0xff, 0x53, 0xc8, 0x1d, 0x20, 0x78, 0xf3, 0xd6, 0x99, + 0xc7, 0x1d, 0x77, 0x6c, 0x49, 0x5b, 0xcb, 0xda, 0xa5, 0x83, 0x2b, 0xa7, 0xb8, 0x70, 0x22, 0xe6, + 0xdf, 0xbe, 0x05, 0x8d, 0xd4, 0x2b, 0x04, 0xa9, 0x41, 0xf9, 0x13, 0xf6, 0xb2, 0xb3, 0x46, 0x1a, + 0x50, 0x33, 0x19, 0xf6, 0x94, 0x1d, 0x6d, 0xff, 0xb3, 0x2a, 0xb4, 0x0f, 0x07, 0x0f, 0x8e, 0x0f, + 0x7d, 0x7f, 0xea, 0x8c, 0x28, 0x36, 0x21, 0x7b, 0x50, 0xc1, 0x3e, 0xac, 0xe0, 0xbd, 0xb9, 0x57, + 0xf4, 0x20, 0x40, 0xf6, 0xa1, 0x8a, 0xed, 0x18, 0x29, 0x7a, 0x76, 0xee, 0x15, 0xbe, 0x0b, 0x88, + 0x1f, 0x91, 0x0d, 0xdb, 0xc5, 0xd7, 0xe7, 0x5e, 0xd1, 0xe3, 0x00, 0xf9, 0x08, 0xf4, 0xa4, 0x4f, + 0x5a, 0xf5, 0x06, 0xdd, 0x5b, 0xf9, 0x4c, 0x20, 0xe4, 0x93, 0x5a, 0x72, 0xd5, 0x8b, 0x6d, 0x6f, + 0x65, 0x3f, 0x4d, 0x0e, 0xa0, 0x16, 0x55, 0xe1, 0xc5, 0xaf, 0xc4, 0xbd, 0x15, 0x2d, 0xbc, 0x30, + 0x8f, 0x6c, 0x7d, 0x8a, 0x9e, 0xb2, 0x7b, 0x85, 0xef, 0x0c, 0xe4, 0x2e, 0xac, 0xab, 0x72, 0xa8, + 0xf0, 0xbd, 0xb7, 0x57, 0xdc, 0x88, 0x0b, 0x25, 0x93, 0xe6, 0x6f, 0xd5, 0x73, 0x7b, 0x6f, 0xe5, + 0x83, 0x08, 0x39, 0x04, 0x48, 0x75, 0x30, 0x2b, 0xdf, 0xd1, 0x7b, 0xab, 0x1f, 0x3a, 0xc8, 0x7d, + 0xa8, 0x27, 0x8f, 0x57, 0xc5, 0xef, 0xdb, 0xbd, 0x55, 0x6f, 0x0f, 0x83, 0x1b, 0xff, 0xfa, 0xcb, + 0x96, 0xf6, 0x9b, 0xf3, 0x2d, 0xed, 0x8b, 0xf3, 0x2d, 0xed, 0xcb, 0xf3, 0x2d, 0xed, 0x0f, 0xe7, + 0x5b, 0xda, 0x9f, 0xcf, 0xb7, 0xb4, 0xdf, 0xfe, 0x75, 0x4b, 0x1b, 0xae, 0x63, 0x8c, 0x7c, 0xf0, + 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x57, 0x10, 0x0d, 0x97, 0x09, 0x1a, 0x00, 0x00, +} + func (this *Request) Equal(that interface{}) bool { if that == nil { return this == nil @@ -5065,12 +4724,6 @@ func (this *Header) Equal(that interface{}) bool { if !this.Time.Equal(that1.Time) { return false } - if this.NumTxs != that1.NumTxs { - return false - } - if this.TotalTxs != that1.TotalTxs { - return false - } if !this.LastBlockId.Equal(&that1.LastBlockId) { return false } @@ -5503,6 +5156,44 @@ type ABCIApplicationServer interface { EndBlock(context.Context, *RequestEndBlock) (*ResponseEndBlock, error) } +// UnimplementedABCIApplicationServer can be embedded to have forward compatible implementations. +type UnimplementedABCIApplicationServer struct { +} + +func (*UnimplementedABCIApplicationServer) Echo(ctx context.Context, req *RequestEcho) (*ResponseEcho, error) { + return nil, status.Errorf(codes.Unimplemented, "method Echo not implemented") +} +func (*UnimplementedABCIApplicationServer) Flush(ctx context.Context, req *RequestFlush) (*ResponseFlush, error) { + return nil, status.Errorf(codes.Unimplemented, "method Flush not implemented") +} +func (*UnimplementedABCIApplicationServer) Info(ctx context.Context, req *RequestInfo) (*ResponseInfo, error) { + return nil, status.Errorf(codes.Unimplemented, "method Info not implemented") +} +func (*UnimplementedABCIApplicationServer) SetOption(ctx context.Context, req *RequestSetOption) (*ResponseSetOption, error) { + return nil, status.Errorf(codes.Unimplemented, "method SetOption not implemented") +} +func (*UnimplementedABCIApplicationServer) DeliverTx(ctx context.Context, req *RequestDeliverTx) (*ResponseDeliverTx, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeliverTx not implemented") +} +func (*UnimplementedABCIApplicationServer) CheckTx(ctx context.Context, req *RequestCheckTx) (*ResponseCheckTx, error) { + return nil, status.Errorf(codes.Unimplemented, "method CheckTx not implemented") +} +func (*UnimplementedABCIApplicationServer) Query(ctx context.Context, req *RequestQuery) (*ResponseQuery, error) { + return nil, status.Errorf(codes.Unimplemented, "method Query not implemented") +} +func (*UnimplementedABCIApplicationServer) Commit(ctx context.Context, req *RequestCommit) (*ResponseCommit, error) { + return nil, status.Errorf(codes.Unimplemented, "method Commit not implemented") +} +func (*UnimplementedABCIApplicationServer) InitChain(ctx context.Context, req *RequestInitChain) (*ResponseInitChain, error) { + return nil, status.Errorf(codes.Unimplemented, "method InitChain not implemented") +} +func (*UnimplementedABCIApplicationServer) BeginBlock(ctx context.Context, req *RequestBeginBlock) (*ResponseBeginBlock, error) { + return nil, status.Errorf(codes.Unimplemented, "method BeginBlock not implemented") +} +func (*UnimplementedABCIApplicationServer) EndBlock(ctx context.Context, req *RequestEndBlock) (*ResponseEndBlock, error) { + return nil, status.Errorf(codes.Unimplemented, "method EndBlock not implemented") +} + func RegisterABCIApplicationServer(s *grpc.Server, srv ABCIApplicationServer) { s.RegisterService(&_ABCIApplication_serviceDesc, srv) } @@ -5761,7 +5452,7 @@ var _ABCIApplication_serviceDesc = grpc.ServiceDesc{ func (m *Request) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5769,183 +5460,257 @@ func (m *Request) Marshal() (dAtA []byte, err error) { } func (m *Request) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Value != nil { - nn1, err := m.Value.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn1 - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if m.Value != nil { + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil } func (m *Request_Echo) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Echo != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Echo.Size())) - n2, err := m.Echo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Echo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n2 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Flush) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Flush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Flush != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Flush.Size())) - n3, err := m.Flush.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Flush.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n3 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Info) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Info != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Info.Size())) - n4, err := m.Info.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n4 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_SetOption) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_SetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.SetOption != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.SetOption.Size())) - n5, err := m.SetOption.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.SetOption.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n5 + i-- + dAtA[i] = 0x2a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_InitChain) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_InitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.InitChain != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.InitChain.Size())) - n6, err := m.InitChain.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.InitChain.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n6 + i-- + dAtA[i] = 0x32 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Query) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Query != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Query.Size())) - n7, err := m.Query.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n7 + i-- + dAtA[i] = 0x3a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_BeginBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_BeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.BeginBlock != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.BeginBlock.Size())) - n8, err := m.BeginBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.BeginBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n8 + i-- + dAtA[i] = 0x42 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_CheckTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_CheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.CheckTx != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.CheckTx.Size())) - n9, err := m.CheckTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.CheckTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n9 + i-- + dAtA[i] = 0x4a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_EndBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_EndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.EndBlock != nil { - dAtA[i] = 0x5a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.EndBlock.Size())) - n10, err := m.EndBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.EndBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n10 + i-- + dAtA[i] = 0x5a } - return i, nil + return len(dAtA) - i, nil } func (m *Request_Commit) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Commit != nil { - dAtA[i] = 0x62 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Commit.Size())) - n11, err := m.Commit.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Commit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n11 + i-- + dAtA[i] = 0x62 } - return i, nil + return len(dAtA) - i, nil } func (m *Request_DeliverTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Request_DeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.DeliverTx != nil { - dAtA[i] = 0x9a - i++ - dAtA[i] = 0x1 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.DeliverTx.Size())) - n12, err := m.DeliverTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.DeliverTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n12 + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x9a } - return i, nil + return len(dAtA) - i, nil } func (m *RequestEcho) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5953,26 +5718,33 @@ func (m *RequestEcho) Marshal() (dAtA []byte, err error) { } func (m *RequestEcho) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestEcho) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Message) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *RequestFlush) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -5980,20 +5752,26 @@ func (m *RequestFlush) Marshal() (dAtA []byte, err error) { } func (m *RequestFlush) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestFlush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *RequestInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6001,36 +5779,43 @@ func (m *RequestInfo) Marshal() (dAtA []byte, err error) { } func (m *RequestInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Version) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) - i += copy(dAtA[i:], m.Version) - } - if m.BlockVersion != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.BlockVersion)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.P2PVersion != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.P2PVersion)) + i-- + dAtA[i] = 0x18 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.BlockVersion != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.BlockVersion)) + i-- + dAtA[i] = 0x10 } - return i, nil + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *RequestSetOption) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6038,32 +5823,40 @@ func (m *RequestSetOption) Marshal() (dAtA []byte, err error) { } func (m *RequestSetOption) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestSetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Key) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Value) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Value) + copy(dAtA[i:], m.Value) i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestInitChain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6071,62 +5864,74 @@ func (m *RequestInitChain) Marshal() (dAtA []byte, err error) { } func (m *RequestInitChain) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n13, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n13 - if len(m.ChainId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId))) - i += copy(dAtA[i:], m.ChainId) - } - if m.ConsensusParams != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusParams.Size())) - n14, err := m.ConsensusParams.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n14 + if len(m.AppStateBytes) > 0 { + i -= len(m.AppStateBytes) + copy(dAtA[i:], m.AppStateBytes) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AppStateBytes))) + i-- + dAtA[i] = 0x2a } if len(m.Validators) > 0 { - for _, msg := range m.Validators { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.ConsensusParams != nil { + { + size, err := m.ConsensusParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a } - if len(m.AppStateBytes) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.AppStateBytes))) - i += copy(dAtA[i:], m.AppStateBytes) + if len(m.ChainId) > 0 { + i -= len(m.ChainId) + copy(dAtA[i:], m.ChainId) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainId))) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + n13, err13 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err13 != nil { + return 0, err13 } - return i, nil + i -= n13 + i = encodeVarintTypes(dAtA, i, uint64(n13)) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *RequestQuery) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6134,47 +5939,55 @@ func (m *RequestQuery) Marshal() (dAtA []byte, err error) { } func (m *RequestQuery) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Data) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if len(m.Path) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Path))) - i += copy(dAtA[i:], m.Path) - } - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Prove { - dAtA[i] = 0x20 - i++ + i-- if m.Prove { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x20 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 } - return i, nil + if len(m.Path) > 0 { + i -= len(m.Path) + copy(dAtA[i:], m.Path) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Path))) + i-- + dAtA[i] = 0x12 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *RequestBeginBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6182,54 +5995,67 @@ func (m *RequestBeginBlock) Marshal() (dAtA []byte, err error) { } func (m *RequestBeginBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestBeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Hash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Header.Size())) - n15, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n15 - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LastCommitInfo.Size())) - n16, err := m.LastCommitInfo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n16 if len(m.ByzantineValidators) > 0 { - for _, msg := range m.ByzantineValidators { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.ByzantineValidators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ByzantineValidators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x22 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size, err := m.LastCommitInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0x1a + { + size, err := m.Header.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *RequestCheckTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6237,31 +6063,38 @@ func (m *RequestCheckTx) Marshal() (dAtA []byte, err error) { } func (m *RequestCheckTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestCheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Tx) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) - i += copy(dAtA[i:], m.Tx) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Type != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.Type)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *RequestDeliverTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6269,26 +6102,33 @@ func (m *RequestDeliverTx) Marshal() (dAtA []byte, err error) { } func (m *RequestDeliverTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestDeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Tx) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) - i += copy(dAtA[i:], m.Tx) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if len(m.Tx) > 0 { + i -= len(m.Tx) + copy(dAtA[i:], m.Tx) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Tx))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *RequestEndBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6296,25 +6136,31 @@ func (m *RequestEndBlock) Marshal() (dAtA []byte, err error) { } func (m *RequestEndBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestEndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *RequestCommit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6322,20 +6168,26 @@ func (m *RequestCommit) Marshal() (dAtA []byte, err error) { } func (m *RequestCommit) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *RequestCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *Response) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6343,195 +6195,275 @@ func (m *Response) Marshal() (dAtA []byte, err error) { } func (m *Response) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Value != nil { - nn17, err := m.Value.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += nn17 - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if m.Value != nil { + { + size := m.Value.Size() + i -= size + if _, err := m.Value.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + return len(dAtA) - i, nil } func (m *Response_Exception) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Exception) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Exception != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Exception.Size())) - n18, err := m.Exception.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Exception.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n18 + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Echo) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Echo != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Echo.Size())) - n19, err := m.Echo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Echo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n19 + i-- + dAtA[i] = 0x12 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Flush) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Flush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Flush != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Flush.Size())) - n20, err := m.Flush.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Flush.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n20 + i-- + dAtA[i] = 0x1a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Info) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Info != nil { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Info.Size())) - n21, err := m.Info.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Info.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n21 + i-- + dAtA[i] = 0x22 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_SetOption) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_SetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.SetOption != nil { - dAtA[i] = 0x2a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.SetOption.Size())) - n22, err := m.SetOption.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.SetOption.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n22 + i-- + dAtA[i] = 0x2a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_InitChain) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_InitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.InitChain != nil { - dAtA[i] = 0x32 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.InitChain.Size())) - n23, err := m.InitChain.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.InitChain.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n23 + i-- + dAtA[i] = 0x32 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Query) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Query != nil { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Query.Size())) - n24, err := m.Query.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Query.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n24 + i-- + dAtA[i] = 0x3a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_BeginBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_BeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.BeginBlock != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.BeginBlock.Size())) - n25, err := m.BeginBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.BeginBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n25 + i-- + dAtA[i] = 0x42 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_CheckTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_CheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.CheckTx != nil { - dAtA[i] = 0x4a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.CheckTx.Size())) - n26, err := m.CheckTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.CheckTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n26 + i-- + dAtA[i] = 0x4a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_DeliverTx) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_DeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.DeliverTx != nil { - dAtA[i] = 0x52 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.DeliverTx.Size())) - n27, err := m.DeliverTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.DeliverTx.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n27 + i-- + dAtA[i] = 0x52 } - return i, nil + return len(dAtA) - i, nil } func (m *Response_EndBlock) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_EndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.EndBlock != nil { - dAtA[i] = 0x5a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.EndBlock.Size())) - n28, err := m.EndBlock.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.EndBlock.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n28 + i-- + dAtA[i] = 0x5a } - return i, nil + return len(dAtA) - i, nil } func (m *Response_Commit) MarshalTo(dAtA []byte) (int, error) { - i := 0 + return m.MarshalToSizedBuffer(dAtA[:m.Size()]) +} + +func (m *Response_Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) if m.Commit != nil { - dAtA[i] = 0x62 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Commit.Size())) - n29, err := m.Commit.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Commit.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n29 + i-- + dAtA[i] = 0x62 } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseException) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6539,26 +6471,33 @@ func (m *ResponseException) Marshal() (dAtA []byte, err error) { } func (m *ResponseException) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseException) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Error) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Error))) - i += copy(dAtA[i:], m.Error) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if len(m.Error) > 0 { + i -= len(m.Error) + copy(dAtA[i:], m.Error) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Error))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ResponseEcho) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6566,26 +6505,33 @@ func (m *ResponseEcho) Marshal() (dAtA []byte, err error) { } func (m *ResponseEcho) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseEcho) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Message) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if len(m.Message) > 0 { + i -= len(m.Message) + copy(dAtA[i:], m.Message) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Message))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ResponseFlush) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6593,20 +6539,26 @@ func (m *ResponseFlush) Marshal() (dAtA []byte, err error) { } func (m *ResponseFlush) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseFlush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6614,48 +6566,57 @@ func (m *ResponseInfo) Marshal() (dAtA []byte, err error) { } func (m *ResponseInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Data) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if len(m.Version) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) - i += copy(dAtA[i:], m.Version) - } - if m.AppVersion != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.AppVersion)) - } - if m.LastBlockHeight != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LastBlockHeight)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.LastBlockAppHash) > 0 { - dAtA[i] = 0x2a - i++ + i -= len(m.LastBlockAppHash) + copy(dAtA[i:], m.LastBlockAppHash) i = encodeVarintTypes(dAtA, i, uint64(len(m.LastBlockAppHash))) - i += copy(dAtA[i:], m.LastBlockAppHash) + i-- + dAtA[i] = 0x2a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.LastBlockHeight != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.LastBlockHeight)) + i-- + dAtA[i] = 0x20 } - return i, nil + if m.AppVersion != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.AppVersion)) + i-- + dAtA[i] = 0x18 + } + if len(m.Version) > 0 { + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *ResponseSetOption) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6663,37 +6624,45 @@ func (m *ResponseSetOption) Marshal() (dAtA []byte, err error) { } func (m *ResponseSetOption) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseSetOption) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) - } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ + i -= len(m.Info) + copy(dAtA[i:], m.Info) i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) + i-- + dAtA[i] = 0x22 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a } - return i, nil + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *ResponseInitChain) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6701,42 +6670,52 @@ func (m *ResponseInitChain) Marshal() (dAtA []byte, err error) { } func (m *ResponseInitChain) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.ConsensusParams != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusParams.Size())) - n30, err := m.ConsensusParams.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n30 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Validators) > 0 { - for _, msg := range m.Validators { + for iNdEx := len(m.Validators) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Validators[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + } + } + if m.ConsensusParams != nil { + { + size, err := m.ConsensusParams.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0xa } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseQuery) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6744,75 +6723,88 @@ func (m *ResponseQuery) Marshal() (dAtA []byte, err error) { } func (m *ResponseQuery) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) - } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) - } - if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) - } - if m.Index != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Index)) - } - if len(m.Key) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) - } - if len(m.Value) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) - i += copy(dAtA[i:], m.Value) - } - if m.Proof != nil { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Proof.Size())) - n31, err := m.Proof.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n31 - } - if m.Height != 0 { - dAtA[i] = 0x48 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Codespace) > 0 { - dAtA[i] = 0x52 - i++ + i -= len(m.Codespace) + copy(dAtA[i:], m.Codespace) i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) - i += copy(dAtA[i:], m.Codespace) + i-- + dAtA[i] = 0x52 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x48 } - return i, nil + if m.Proof != nil { + { + size, err := m.Proof.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + if len(m.Value) > 0 { + i -= len(m.Value) + copy(dAtA[i:], m.Value) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Value))) + i-- + dAtA[i] = 0x3a + } + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x32 + } + if m.Index != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Index)) + i-- + dAtA[i] = 0x28 + } + if len(m.Info) > 0 { + i -= len(m.Info) + copy(dAtA[i:], m.Info) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) + i-- + dAtA[i] = 0x22 + } + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a + } + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *ResponseBeginBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6820,32 +6812,40 @@ func (m *ResponseBeginBlock) Marshal() (dAtA []byte, err error) { } func (m *ResponseBeginBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseBeginBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseCheckTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6853,71 +6853,83 @@ func (m *ResponseCheckTx) Marshal() (dAtA []byte, err error) { } func (m *ResponseCheckTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseCheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) - } - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) - } - if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) - } - if m.GasWanted != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.GasWanted)) - } - if m.GasUsed != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) - } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Codespace) > 0 { - dAtA[i] = 0x42 - i++ + i -= len(m.Codespace) + copy(dAtA[i:], m.Codespace) i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) - i += copy(dAtA[i:], m.Codespace) + i-- + dAtA[i] = 0x42 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } } - return i, nil + if m.GasUsed != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x30 + } + if m.GasWanted != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.GasWanted)) + i-- + dAtA[i] = 0x28 + } + if len(m.Info) > 0 { + i -= len(m.Info) + copy(dAtA[i:], m.Info) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) + i-- + dAtA[i] = 0x22 + } + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *ResponseDeliverTx) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6925,71 +6937,83 @@ func (m *ResponseDeliverTx) Marshal() (dAtA []byte, err error) { } func (m *ResponseDeliverTx) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseDeliverTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Code != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Code)) - } - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - if len(m.Log) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) - i += copy(dAtA[i:], m.Log) - } - if len(m.Info) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) - i += copy(dAtA[i:], m.Info) - } - if m.GasWanted != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.GasWanted)) - } - if m.GasUsed != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) - } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Codespace) > 0 { - dAtA[i] = 0x42 - i++ + i -= len(m.Codespace) + copy(dAtA[i:], m.Codespace) i = encodeVarintTypes(dAtA, i, uint64(len(m.Codespace))) - i += copy(dAtA[i:], m.Codespace) + i-- + dAtA[i] = 0x42 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } } - return i, nil + if m.GasUsed != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.GasUsed)) + i-- + dAtA[i] = 0x30 + } + if m.GasWanted != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.GasWanted)) + i-- + dAtA[i] = 0x28 + } + if len(m.Info) > 0 { + i -= len(m.Info) + copy(dAtA[i:], m.Info) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Info))) + i-- + dAtA[i] = 0x22 + } + if len(m.Log) > 0 { + i -= len(m.Log) + copy(dAtA[i:], m.Log) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Log))) + i-- + dAtA[i] = 0x1a + } + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + if m.Code != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Code)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *ResponseEndBlock) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -6997,54 +7021,66 @@ func (m *ResponseEndBlock) Marshal() (dAtA []byte, err error) { } func (m *ResponseEndBlock) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseEndBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.ValidatorUpdates) > 0 { - for _, msg := range m.ValidatorUpdates { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } + if len(m.Events) > 0 { + for iNdEx := len(m.Events) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Events[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x1a } } if m.ConsensusParamUpdates != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.ConsensusParamUpdates.Size())) - n32, err := m.ConsensusParamUpdates.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n32 - } - if len(m.Events) > 0 { - for _, msg := range m.Events { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) + { + size, err := m.ConsensusParamUpdates.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } - i += n + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + if len(m.ValidatorUpdates) > 0 { + for iNdEx := len(m.ValidatorUpdates) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ValidatorUpdates[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *ResponseCommit) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7052,26 +7088,33 @@ func (m *ResponseCommit) Marshal() (dAtA []byte, err error) { } func (m *ResponseCommit) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ResponseCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if len(m.Data) > 0 { + i -= len(m.Data) + copy(dAtA[i:], m.Data) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) + i-- + dAtA[i] = 0x12 + } + return len(dAtA) - i, nil } func (m *ConsensusParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7079,50 +7122,62 @@ func (m *ConsensusParams) Marshal() (dAtA []byte, err error) { } func (m *ConsensusParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ConsensusParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Block != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Block.Size())) - n33, err := m.Block.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n33 - } - if m.Evidence != nil { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Evidence.Size())) - n34, err := m.Evidence.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n34 + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Validator != nil { - dAtA[i] = 0x1a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Validator.Size())) - n35, err := m.Validator.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n35 + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Evidence != nil { + { + size, err := m.Evidence.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - return i, nil + if m.Block != nil { + { + size, err := m.Block.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *BlockParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7130,30 +7185,36 @@ func (m *BlockParams) Marshal() (dAtA []byte, err error) { } func (m *BlockParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.MaxBytes != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.MaxBytes)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.MaxGas != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.MaxGas)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.MaxBytes != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MaxBytes)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *EvidenceParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7161,25 +7222,31 @@ func (m *EvidenceParams) Marshal() (dAtA []byte, err error) { } func (m *EvidenceParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *EvidenceParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.MaxAge != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.MaxAge)) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if m.MaxAge != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.MaxAge)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil } func (m *ValidatorParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7187,35 +7254,35 @@ func (m *ValidatorParams) Marshal() (dAtA []byte, err error) { } func (m *ValidatorParams) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.PubKeyTypes) > 0 { - for _, s := range m.PubKeyTypes { + for iNdEx := len(m.PubKeyTypes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.PubKeyTypes[iNdEx]) + copy(dAtA[i:], m.PubKeyTypes[iNdEx]) + i = encodeVarintTypes(dAtA, i, uint64(len(m.PubKeyTypes[iNdEx]))) + i-- dAtA[i] = 0xa - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func (m *LastCommitInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7223,37 +7290,45 @@ func (m *LastCommitInfo) Marshal() (dAtA []byte, err error) { } func (m *LastCommitInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LastCommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Round != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Round)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Votes) > 0 { - for _, msg := range m.Votes { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Votes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Votes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Round != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Round)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Event) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7261,38 +7336,47 @@ func (m *Event) Marshal() (dAtA []byte, err error) { } func (m *Event) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Attributes) > 0 { - for _, msg := range m.Attributes { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Attributes) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Attributes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0x12 } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Header) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7300,121 +7384,129 @@ func (m *Header) Marshal() (dAtA []byte, err error) { } func (m *Header) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Version.Size())) - n36, err := m.Version.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n36 - if len(m.ChainID) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainID))) - i += copy(dAtA[i:], m.ChainID) - } - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) - } - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n37, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err - } - i += n37 - if m.NumTxs != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.NumTxs)) - } - if m.TotalTxs != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.TotalTxs)) - } - dAtA[i] = 0x3a - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.LastBlockId.Size())) - n38, err := m.LastBlockId.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n38 - if len(m.LastCommitHash) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.LastCommitHash))) - i += copy(dAtA[i:], m.LastCommitHash) - } - if len(m.DataHash) > 0 { - dAtA[i] = 0x4a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.DataHash))) - i += copy(dAtA[i:], m.DataHash) - } - if len(m.ValidatorsHash) > 0 { - dAtA[i] = 0x52 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorsHash))) - i += copy(dAtA[i:], m.ValidatorsHash) - } - if len(m.NextValidatorsHash) > 0 { - dAtA[i] = 0x5a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.NextValidatorsHash))) - i += copy(dAtA[i:], m.NextValidatorsHash) - } - if len(m.ConsensusHash) > 0 { - dAtA[i] = 0x62 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.ConsensusHash))) - i += copy(dAtA[i:], m.ConsensusHash) - } - if len(m.AppHash) > 0 { - dAtA[i] = 0x6a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) - i += copy(dAtA[i:], m.AppHash) - } - if len(m.LastResultsHash) > 0 { - dAtA[i] = 0x72 - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) - i += copy(dAtA[i:], m.LastResultsHash) - } - if len(m.EvidenceHash) > 0 { - dAtA[i] = 0x7a - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.EvidenceHash))) - i += copy(dAtA[i:], m.EvidenceHash) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.ProposerAddress) > 0 { - dAtA[i] = 0x82 - i++ - dAtA[i] = 0x1 - i++ + i -= len(m.ProposerAddress) + copy(dAtA[i:], m.ProposerAddress) i = encodeVarintTypes(dAtA, i, uint64(len(m.ProposerAddress))) - i += copy(dAtA[i:], m.ProposerAddress) + i-- + dAtA[i] = 0x72 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.EvidenceHash) > 0 { + i -= len(m.EvidenceHash) + copy(dAtA[i:], m.EvidenceHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.EvidenceHash))) + i-- + dAtA[i] = 0x6a } - return i, nil + if len(m.LastResultsHash) > 0 { + i -= len(m.LastResultsHash) + copy(dAtA[i:], m.LastResultsHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.LastResultsHash))) + i-- + dAtA[i] = 0x62 + } + if len(m.AppHash) > 0 { + i -= len(m.AppHash) + copy(dAtA[i:], m.AppHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.AppHash))) + i-- + dAtA[i] = 0x5a + } + if len(m.ConsensusHash) > 0 { + i -= len(m.ConsensusHash) + copy(dAtA[i:], m.ConsensusHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ConsensusHash))) + i-- + dAtA[i] = 0x52 + } + if len(m.NextValidatorsHash) > 0 { + i -= len(m.NextValidatorsHash) + copy(dAtA[i:], m.NextValidatorsHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.NextValidatorsHash))) + i-- + dAtA[i] = 0x4a + } + if len(m.ValidatorsHash) > 0 { + i -= len(m.ValidatorsHash) + copy(dAtA[i:], m.ValidatorsHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ValidatorsHash))) + i-- + dAtA[i] = 0x42 + } + if len(m.DataHash) > 0 { + i -= len(m.DataHash) + copy(dAtA[i:], m.DataHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.DataHash))) + i-- + dAtA[i] = 0x3a + } + if len(m.LastCommitHash) > 0 { + i -= len(m.LastCommitHash) + copy(dAtA[i:], m.LastCommitHash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.LastCommitHash))) + i-- + dAtA[i] = 0x32 + } + { + size, err := m.LastBlockId.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + n35, err35 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err35 != nil { + return 0, err35 + } + i -= n35 + i = encodeVarintTypes(dAtA, i, uint64(n35)) + i-- + dAtA[i] = 0x22 + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + if len(m.ChainID) > 0 { + i -= len(m.ChainID) + copy(dAtA[i:], m.ChainID) + i = encodeVarintTypes(dAtA, i, uint64(len(m.ChainID))) + i-- + dAtA[i] = 0x12 + } + { + size, err := m.Version.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *Version) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7422,30 +7514,36 @@ func (m *Version) Marshal() (dAtA []byte, err error) { } func (m *Version) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Block != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Block)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.App != 0 { - dAtA[i] = 0x10 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.App)) + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Block != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Block)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *BlockID) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7453,34 +7551,43 @@ func (m *BlockID) Marshal() (dAtA []byte, err error) { } func (m *BlockID) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *BlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Hash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) - } - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.PartsHeader.Size())) - n39, err := m.PartsHeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n39 if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + { + size, err := m.PartsHeader.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Hash) > 0 { + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7488,31 +7595,38 @@ func (m *PartSetHeader) Marshal() (dAtA []byte, err error) { } func (m *PartSetHeader) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PartSetHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if m.Total != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Total)) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Hash) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Hash) + copy(dAtA[i:], m.Hash) i = encodeVarintTypes(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if m.Total != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Total)) + i-- + dAtA[i] = 0x8 } - return i, nil + return len(dAtA) - i, nil } func (m *Validator) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7520,31 +7634,38 @@ func (m *Validator) Marshal() (dAtA []byte, err error) { } func (m *Validator) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Address) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) - i += copy(dAtA[i:], m.Address) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if m.Power != 0 { - dAtA[i] = 0x18 - i++ i = encodeVarintTypes(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x18 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Address) > 0 { + i -= len(m.Address) + copy(dAtA[i:], m.Address) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Address))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *ValidatorUpdate) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7552,33 +7673,41 @@ func (m *ValidatorUpdate) Marshal() (dAtA []byte, err error) { } func (m *ValidatorUpdate) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.PubKey.Size())) - n40, err := m.PubKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n40 - if m.Power != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Power)) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if m.Power != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Power)) + i-- + dAtA[i] = 0x10 + } + { + size, err := m.PubKey.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *VoteInfo) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7586,38 +7715,46 @@ func (m *VoteInfo) Marshal() (dAtA []byte, err error) { } func (m *VoteInfo) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *VoteInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Validator.Size())) - n41, err := m.Validator.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - i += n41 if m.SignedLastBlock { - dAtA[i] = 0x10 - i++ + i-- if m.SignedLastBlock { dAtA[i] = 1 } else { dAtA[i] = 0 } - i++ + i-- + dAtA[i] = 0x10 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) } - return i, nil + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *PubKey) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7625,32 +7762,40 @@ func (m *PubKey) Marshal() (dAtA []byte, err error) { } func (m *PubKey) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PubKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintTypes(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + i-- + dAtA[i] = 0x12 } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa } - return i, nil + return len(dAtA) - i, nil } func (m *Evidence) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -7658,56 +7803,67 @@ func (m *Evidence) Marshal() (dAtA []byte, err error) { } func (m *Evidence) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) - } - dAtA[i] = 0x12 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Validator.Size())) - n42, err := m.Validator.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n42 - if m.Height != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.Height)) - } - dAtA[i] = 0x22 - i++ - i = encodeVarintTypes(dAtA, i, uint64(github_com_gogo_protobuf_types.SizeOfStdTime(m.Time))) - n43, err := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i:]) - if err != nil { - return 0, err - } - i += n43 - if m.TotalVotingPower != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTypes(dAtA, i, uint64(m.TotalVotingPower)) - } if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } - return i, nil + if m.TotalVotingPower != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.TotalVotingPower)) + i-- + dAtA[i] = 0x28 + } + n40, err40 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + if err40 != nil { + return 0, err40 + } + i -= n40 + i = encodeVarintTypes(dAtA, i, uint64(n40)) + i-- + dAtA[i] = 0x22 + if m.Height != 0 { + i = encodeVarintTypes(dAtA, i, uint64(m.Height)) + i-- + dAtA[i] = 0x18 + } + { + size, err := m.Validator.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTypes(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintTypes(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func encodeVarintTypes(dAtA []byte, offset int, v uint64) int { + offset -= sovTypes(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func NewPopulatedRequest(r randyTypes, easy bool) *Request { this := &Request{} @@ -7840,10 +7996,10 @@ func NewPopulatedRequestInitChain(r randyTypes, easy bool) *RequestInitChain { v1 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) this.Time = *v1 this.ChainId = string(randStringTypes(r)) - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.ConsensusParams = NewPopulatedConsensusParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v2 := r.Intn(5) this.Validators = make([]ValidatorUpdate, v2) for i := 0; i < v2; i++ { @@ -7892,7 +8048,7 @@ func NewPopulatedRequestBeginBlock(r randyTypes, easy bool) *RequestBeginBlock { this.Header = *v7 v8 := NewPopulatedLastCommitInfo(r, easy) this.LastCommitInfo = *v8 - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v9 := r.Intn(5) this.ByzantineValidators = make([]Evidence, v9) for i := 0; i < v9; i++ { @@ -8107,10 +8263,10 @@ func NewPopulatedResponseSetOption(r randyTypes, easy bool) *ResponseSetOption { func NewPopulatedResponseInitChain(r randyTypes, easy bool) *ResponseInitChain { this := &ResponseInitChain{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.ConsensusParams = NewPopulatedConsensusParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v14 := r.Intn(5) this.Validators = make([]ValidatorUpdate, v14) for i := 0; i < v14; i++ { @@ -8143,7 +8299,7 @@ func NewPopulatedResponseQuery(r randyTypes, easy bool) *ResponseQuery { for i := 0; i < v17; i++ { this.Value[i] = byte(r.Intn(256)) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Proof = merkle.NewPopulatedProof(r, easy) } this.Height = int64(r.Int63()) @@ -8159,7 +8315,7 @@ func NewPopulatedResponseQuery(r randyTypes, easy bool) *ResponseQuery { func NewPopulatedResponseBeginBlock(r randyTypes, easy bool) *ResponseBeginBlock { this := &ResponseBeginBlock{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v18 := r.Intn(5) this.Events = make([]Event, v18) for i := 0; i < v18; i++ { @@ -8191,7 +8347,7 @@ func NewPopulatedResponseCheckTx(r randyTypes, easy bool) *ResponseCheckTx { if r.Intn(2) == 0 { this.GasUsed *= -1 } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v21 := r.Intn(5) this.Events = make([]Event, v21) for i := 0; i < v21; i++ { @@ -8224,7 +8380,7 @@ func NewPopulatedResponseDeliverTx(r randyTypes, easy bool) *ResponseDeliverTx { if r.Intn(2) == 0 { this.GasUsed *= -1 } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v24 := r.Intn(5) this.Events = make([]Event, v24) for i := 0; i < v24; i++ { @@ -8241,7 +8397,7 @@ func NewPopulatedResponseDeliverTx(r randyTypes, easy bool) *ResponseDeliverTx { func NewPopulatedResponseEndBlock(r randyTypes, easy bool) *ResponseEndBlock { this := &ResponseEndBlock{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v26 := r.Intn(5) this.ValidatorUpdates = make([]ValidatorUpdate, v26) for i := 0; i < v26; i++ { @@ -8249,10 +8405,10 @@ func NewPopulatedResponseEndBlock(r randyTypes, easy bool) *ResponseEndBlock { this.ValidatorUpdates[i] = *v27 } } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.ConsensusParamUpdates = NewPopulatedConsensusParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v28 := r.Intn(5) this.Events = make([]Event, v28) for i := 0; i < v28; i++ { @@ -8281,13 +8437,13 @@ func NewPopulatedResponseCommit(r randyTypes, easy bool) *ResponseCommit { func NewPopulatedConsensusParams(r randyTypes, easy bool) *ConsensusParams { this := &ConsensusParams{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Block = NewPopulatedBlockParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Evidence = NewPopulatedEvidenceParams(r, easy) } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { this.Validator = NewPopulatedValidatorParams(r, easy) } if !easy && r.Intn(10) != 0 { @@ -8343,7 +8499,7 @@ func NewPopulatedLastCommitInfo(r randyTypes, easy bool) *LastCommitInfo { if r.Intn(2) == 0 { this.Round *= -1 } - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v32 := r.Intn(5) this.Votes = make([]VoteInfo, v32) for i := 0; i < v32; i++ { @@ -8360,7 +8516,7 @@ func NewPopulatedLastCommitInfo(r randyTypes, easy bool) *LastCommitInfo { func NewPopulatedEvent(r randyTypes, easy bool) *Event { this := &Event{} this.Type = string(randStringTypes(r)) - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v34 := r.Intn(5) this.Attributes = make([]common.KVPair, v34) for i := 0; i < v34; i++ { @@ -8385,14 +8541,6 @@ func NewPopulatedHeader(r randyTypes, easy bool) *Header { } v37 := github_com_gogo_protobuf_types.NewPopulatedStdTime(r, easy) this.Time = *v37 - this.NumTxs = int64(r.Int63()) - if r.Intn(2) == 0 { - this.NumTxs *= -1 - } - this.TotalTxs = int64(r.Int63()) - if r.Intn(2) == 0 { - this.TotalTxs *= -1 - } v38 := NewPopulatedBlockID(r, easy) this.LastBlockId = *v38 v39 := r.Intn(100) @@ -8441,7 +8589,7 @@ func NewPopulatedHeader(r randyTypes, easy bool) *Header { this.ProposerAddress[i] = byte(r.Intn(256)) } if !easy && r.Intn(10) != 0 { - this.XXX_unrecognized = randUnrecognizedTypes(r, 17) + this.XXX_unrecognized = randUnrecognizedTypes(r, 15) } return this } @@ -9606,12 +9754,6 @@ func (m *Header) Size() (n int) { } l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) n += 1 + l + sovTypes(uint64(l)) - if m.NumTxs != 0 { - n += 1 + sovTypes(uint64(m.NumTxs)) - } - if m.TotalTxs != 0 { - n += 1 + sovTypes(uint64(m.TotalTxs)) - } l = m.LastBlockId.Size() n += 1 + l + sovTypes(uint64(l)) l = len(m.LastCommitHash) @@ -9648,7 +9790,7 @@ func (m *Header) Size() (n int) { } l = len(m.ProposerAddress) if l > 0 { - n += 2 + l + sovTypes(uint64(l)) + n += 1 + l + sovTypes(uint64(l)) } if m.XXX_unrecognized != nil { n += len(m.XXX_unrecognized) @@ -9811,14 +9953,7 @@ func (m *Evidence) Size() (n int) { } func sovTypes(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozTypes(x uint64) (n int) { return sovTypes(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -9838,7 +9973,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -9866,7 +10001,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9875,6 +10010,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9898,7 +10036,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9907,6 +10045,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9930,7 +10071,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9939,6 +10080,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9962,7 +10106,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -9971,6 +10115,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -9994,7 +10141,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10003,6 +10150,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10026,7 +10176,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10035,6 +10185,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10058,7 +10211,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10067,6 +10220,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10090,7 +10246,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10099,6 +10255,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10122,7 +10281,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10131,6 +10290,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10154,7 +10316,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10163,6 +10325,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10186,7 +10351,7 @@ func (m *Request) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10195,6 +10360,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10213,6 +10381,9 @@ func (m *Request) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10241,7 +10412,7 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10269,7 +10440,7 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10279,6 +10450,9 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10293,6 +10467,9 @@ func (m *RequestEcho) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10321,7 +10498,7 @@ func (m *RequestFlush) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10344,6 +10521,9 @@ func (m *RequestFlush) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10372,7 +10552,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10400,7 +10580,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10410,6 +10590,9 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10429,7 +10612,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.BlockVersion |= (uint64(b) & 0x7F) << shift + m.BlockVersion |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10448,7 +10631,7 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.P2PVersion |= (uint64(b) & 0x7F) << shift + m.P2PVersion |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10462,6 +10645,9 @@ func (m *RequestInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10490,7 +10676,7 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10518,7 +10704,7 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10528,6 +10714,9 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10547,7 +10736,7 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10557,6 +10746,9 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10571,6 +10763,9 @@ func (m *RequestSetOption) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10599,7 +10794,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10627,7 +10822,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10636,6 +10831,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10657,7 +10855,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10667,6 +10865,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10686,7 +10887,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10695,6 +10896,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10719,7 +10923,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10728,6 +10932,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10750,7 +10957,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10759,6 +10966,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10776,6 +10986,9 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10804,7 +11017,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10832,7 +11045,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10841,6 +11054,9 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10863,7 +11079,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10873,6 +11089,9 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -10892,7 +11111,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -10911,7 +11130,7 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10926,6 +11145,9 @@ func (m *RequestQuery) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -10954,7 +11176,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -10982,7 +11204,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -10991,6 +11213,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11013,7 +11238,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11022,6 +11247,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11043,7 +11271,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11052,6 +11280,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11073,7 +11304,7 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11082,6 +11313,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11099,6 +11333,9 @@ func (m *RequestBeginBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11127,7 +11364,7 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11155,7 +11392,7 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11164,6 +11401,9 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11186,7 +11426,7 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Type |= (CheckTxType(b) & 0x7F) << shift + m.Type |= CheckTxType(b&0x7F) << shift if b < 0x80 { break } @@ -11200,6 +11440,9 @@ func (m *RequestCheckTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11228,7 +11471,7 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11256,7 +11499,7 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11265,6 +11508,9 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11282,6 +11528,9 @@ func (m *RequestDeliverTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11310,7 +11559,7 @@ func (m *RequestEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11338,7 +11587,7 @@ func (m *RequestEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -11352,6 +11601,9 @@ func (m *RequestEndBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11380,7 +11632,7 @@ func (m *RequestCommit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11403,6 +11655,9 @@ func (m *RequestCommit) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11431,7 +11686,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11459,7 +11714,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11468,6 +11723,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11491,7 +11749,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11500,6 +11758,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11523,7 +11784,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11532,6 +11793,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11555,7 +11819,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11564,6 +11828,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11587,7 +11854,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11596,6 +11863,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11619,7 +11889,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11628,6 +11898,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11651,7 +11924,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11660,6 +11933,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11683,7 +11959,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11692,6 +11968,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11715,7 +11994,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11724,6 +12003,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11747,7 +12029,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11756,6 +12038,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11779,7 +12064,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11788,6 +12073,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11811,7 +12099,7 @@ func (m *Response) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -11820,6 +12108,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11838,6 +12129,9 @@ func (m *Response) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11866,7 +12160,7 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11894,7 +12188,7 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11904,6 +12198,9 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11918,6 +12215,9 @@ func (m *ResponseException) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -11946,7 +12246,7 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11974,7 +12274,7 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -11984,6 +12284,9 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -11998,6 +12301,9 @@ func (m *ResponseEcho) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12026,7 +12332,7 @@ func (m *ResponseFlush) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12049,6 +12355,9 @@ func (m *ResponseFlush) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12077,7 +12386,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12105,7 +12414,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12115,6 +12424,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12134,7 +12446,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12144,6 +12456,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12163,7 +12478,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AppVersion |= (uint64(b) & 0x7F) << shift + m.AppVersion |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12182,7 +12497,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.LastBlockHeight |= (int64(b) & 0x7F) << shift + m.LastBlockHeight |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12201,7 +12516,7 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12210,6 +12525,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12227,6 +12545,9 @@ func (m *ResponseInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12255,7 +12576,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12283,7 +12604,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -12302,7 +12623,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12312,6 +12633,9 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12331,7 +12655,7 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12341,6 +12665,9 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12355,6 +12682,9 @@ func (m *ResponseSetOption) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12383,7 +12713,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12411,7 +12741,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12420,6 +12750,9 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12444,7 +12777,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12453,6 +12786,9 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12470,6 +12806,9 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12498,7 +12837,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12526,7 +12865,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -12545,7 +12884,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12555,6 +12894,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12574,7 +12916,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12584,6 +12926,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12603,7 +12948,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Index |= (int64(b) & 0x7F) << shift + m.Index |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12622,7 +12967,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12631,6 +12976,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12653,7 +13001,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12662,6 +13010,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12684,7 +13035,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12693,6 +13044,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12717,7 +13071,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -12736,7 +13090,7 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12746,6 +13100,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12760,6 +13117,9 @@ func (m *ResponseQuery) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12788,7 +13148,7 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12816,7 +13176,7 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12825,6 +13185,9 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12842,6 +13205,9 @@ func (m *ResponseBeginBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -12870,7 +13236,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12898,7 +13264,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -12917,7 +13283,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -12926,6 +13292,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12948,7 +13317,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12958,6 +13327,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -12977,7 +13349,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -12987,6 +13359,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13006,7 +13381,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasWanted |= (int64(b) & 0x7F) << shift + m.GasWanted |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13025,7 +13400,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasUsed |= (int64(b) & 0x7F) << shift + m.GasUsed |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13044,7 +13419,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13053,6 +13428,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13075,7 +13453,7 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13085,6 +13463,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13099,6 +13480,9 @@ func (m *ResponseCheckTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13127,7 +13511,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13155,7 +13539,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Code |= (uint32(b) & 0x7F) << shift + m.Code |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -13174,7 +13558,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13183,6 +13567,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13205,7 +13592,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13215,6 +13602,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13234,7 +13624,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13244,6 +13634,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13263,7 +13656,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasWanted |= (int64(b) & 0x7F) << shift + m.GasWanted |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13282,7 +13675,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.GasUsed |= (int64(b) & 0x7F) << shift + m.GasUsed |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13301,7 +13694,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13310,6 +13703,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13332,7 +13728,7 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13342,6 +13738,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13356,6 +13755,9 @@ func (m *ResponseDeliverTx) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13384,7 +13786,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13412,7 +13814,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13421,6 +13823,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13443,7 +13848,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13452,6 +13857,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13476,7 +13884,7 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13485,6 +13893,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13502,6 +13913,9 @@ func (m *ResponseEndBlock) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13530,7 +13944,7 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13558,7 +13972,7 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13567,6 +13981,9 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13584,6 +14001,9 @@ func (m *ResponseCommit) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13612,7 +14032,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13640,7 +14060,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13649,6 +14069,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13673,7 +14096,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13682,6 +14105,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13706,7 +14132,7 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -13715,6 +14141,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13734,6 +14163,9 @@ func (m *ConsensusParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13762,7 +14194,7 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13790,7 +14222,7 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxBytes |= (int64(b) & 0x7F) << shift + m.MaxBytes |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13809,7 +14241,7 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxGas |= (int64(b) & 0x7F) << shift + m.MaxGas |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13823,6 +14255,9 @@ func (m *BlockParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13851,7 +14286,7 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13879,7 +14314,7 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaxAge |= (int64(b) & 0x7F) << shift + m.MaxAge |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -13893,6 +14328,9 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -13921,7 +14359,7 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13949,7 +14387,7 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -13959,6 +14397,9 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -13973,6 +14414,9 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14001,7 +14445,7 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14029,7 +14473,7 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Round |= (int32(b) & 0x7F) << shift + m.Round |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -14048,7 +14492,7 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14057,6 +14501,9 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14074,6 +14521,9 @@ func (m *LastCommitInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14102,7 +14552,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14130,7 +14580,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14140,6 +14590,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14159,7 +14612,7 @@ func (m *Event) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14168,6 +14621,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14185,6 +14641,9 @@ func (m *Event) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14213,7 +14672,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14241,7 +14700,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14250,6 +14709,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14271,7 +14733,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14281,6 +14743,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14300,7 +14765,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -14319,7 +14784,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14328,6 +14793,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14336,44 +14804,6 @@ func (m *Header) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NumTxs", wireType) - } - m.NumTxs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NumTxs |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalTxs", wireType) - } - m.TotalTxs = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalTxs |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastBlockId", wireType) } @@ -14387,7 +14817,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14396,6 +14826,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14403,7 +14836,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastCommitHash", wireType) } @@ -14417,7 +14850,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14426,6 +14859,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14434,7 +14870,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.LastCommitHash = []byte{} } iNdEx = postIndex - case 9: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field DataHash", wireType) } @@ -14448,7 +14884,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14457,6 +14893,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14465,7 +14904,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.DataHash = []byte{} } iNdEx = postIndex - case 10: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ValidatorsHash", wireType) } @@ -14479,7 +14918,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14488,6 +14927,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14496,7 +14938,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.ValidatorsHash = []byte{} } iNdEx = postIndex - case 11: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field NextValidatorsHash", wireType) } @@ -14510,7 +14952,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14519,6 +14961,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14527,7 +14972,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.NextValidatorsHash = []byte{} } iNdEx = postIndex - case 12: + case 10: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHash", wireType) } @@ -14541,7 +14986,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14550,6 +14995,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14558,7 +15006,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.ConsensusHash = []byte{} } iNdEx = postIndex - case 13: + case 11: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field AppHash", wireType) } @@ -14572,7 +15020,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14581,6 +15029,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14589,7 +15040,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.AppHash = []byte{} } iNdEx = postIndex - case 14: + case 12: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field LastResultsHash", wireType) } @@ -14603,7 +15054,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14612,6 +15063,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14620,7 +15074,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.LastResultsHash = []byte{} } iNdEx = postIndex - case 15: + case 13: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field EvidenceHash", wireType) } @@ -14634,7 +15088,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14643,6 +15097,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14651,7 +15108,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { m.EvidenceHash = []byte{} } iNdEx = postIndex - case 16: + case 14: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ProposerAddress", wireType) } @@ -14665,7 +15122,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14674,6 +15131,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14691,6 +15151,9 @@ func (m *Header) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14719,7 +15182,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14747,7 +15210,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Block |= (uint64(b) & 0x7F) << shift + m.Block |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14766,7 +15229,7 @@ func (m *Version) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.App |= (uint64(b) & 0x7F) << shift + m.App |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14780,6 +15243,9 @@ func (m *Version) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14808,7 +15274,7 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14836,7 +15302,7 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14845,6 +15311,9 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14867,7 +15336,7 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14876,6 +15345,9 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14892,6 +15364,9 @@ func (m *BlockID) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -14920,7 +15395,7 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -14948,7 +15423,7 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Total |= (int32(b) & 0x7F) << shift + m.Total |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -14967,7 +15442,7 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -14976,6 +15451,9 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -14993,6 +15471,9 @@ func (m *PartSetHeader) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15021,7 +15502,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15049,7 +15530,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15058,6 +15539,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15080,7 +15564,7 @@ func (m *Validator) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Power |= (int64(b) & 0x7F) << shift + m.Power |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15094,6 +15578,9 @@ func (m *Validator) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15122,7 +15609,7 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15150,7 +15637,7 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15159,6 +15646,9 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15180,7 +15670,7 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Power |= (int64(b) & 0x7F) << shift + m.Power |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15194,6 +15684,9 @@ func (m *ValidatorUpdate) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15222,7 +15715,7 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15250,7 +15743,7 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15259,6 +15752,9 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15280,7 +15776,7 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - v |= (int(b) & 0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15295,6 +15791,9 @@ func (m *VoteInfo) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15323,7 +15822,7 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15351,7 +15850,7 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15361,6 +15860,9 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15380,7 +15882,7 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15389,6 +15891,9 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15406,6 +15911,9 @@ func (m *PubKey) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15434,7 +15942,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15462,7 +15970,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -15472,6 +15980,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15491,7 +16002,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15500,6 +16011,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15521,7 +16035,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Height |= (int64(b) & 0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15540,7 +16054,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -15549,6 +16063,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { return ErrInvalidLengthTypes } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTypes + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -15570,7 +16087,7 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.TotalVotingPower |= (int64(b) & 0x7F) << shift + m.TotalVotingPower |= int64(b&0x7F) << shift if b < 0x80 { break } @@ -15584,6 +16101,9 @@ func (m *Evidence) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthTypes } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthTypes + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -15651,10 +16171,13 @@ func skipTypes(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthTypes } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } return iNdEx, nil case 3: for { @@ -15683,6 +16206,9 @@ func skipTypes(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthTypes + } } return iNdEx, nil case 4: @@ -15701,155 +16227,3 @@ var ( ErrInvalidLengthTypes = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowTypes = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("abci/types/types.proto", fileDescriptor_types_30d8160a6576aafe) } -func init() { - golang_proto.RegisterFile("abci/types/types.proto", fileDescriptor_types_30d8160a6576aafe) -} - -var fileDescriptor_types_30d8160a6576aafe = []byte{ - // 2282 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0xcd, 0x73, 0x1c, 0x47, - 0x15, 0xd7, 0xec, 0xf7, 0xbc, 0xd5, 0x7e, 0xb8, 0x2d, 0xdb, 0xeb, 0xc5, 0x48, 0xae, 0x31, 0x38, - 0x52, 0xe2, 0xac, 0x12, 0x05, 0x53, 0x32, 0x0e, 0xa9, 0xd2, 0xda, 0x06, 0xa9, 0x62, 0x82, 0x18, - 0xdb, 0xe2, 0x42, 0xd5, 0x54, 0xef, 0x4e, 0x7b, 0x77, 0xca, 0xbb, 0x33, 0x93, 0x99, 0x5e, 0x79, - 0xc5, 0x91, 0x73, 0x0e, 0x39, 0xf0, 0x27, 0x70, 0xe0, 0x4f, 0xc8, 0x91, 0x13, 0x95, 0x23, 0x07, - 0xce, 0x06, 0x44, 0x71, 0xa1, 0x8a, 0x33, 0x70, 0xa3, 0xfa, 0x75, 0xcf, 0xa7, 0x66, 0x4d, 0x62, - 0xb8, 0xe5, 0xb2, 0x3b, 0xdd, 0xef, 0xf7, 0x7a, 0xba, 0xdf, 0xbc, 0xf7, 0x7e, 0xef, 0x35, 0x5c, - 0xa5, 0xa3, 0xb1, 0xb3, 0xcb, 0xcf, 0x7c, 0x16, 0xca, 0xdf, 0x81, 0x1f, 0x78, 0xdc, 0x23, 0x55, - 0x1c, 0xf4, 0xdf, 0x9d, 0x38, 0x7c, 0xba, 0x18, 0x0d, 0xc6, 0xde, 0x7c, 0x77, 0xe2, 0x4d, 0xbc, - 0x5d, 0x94, 0x8e, 0x16, 0xcf, 0x71, 0x84, 0x03, 0x7c, 0x92, 0x5a, 0xfd, 0xfb, 0x29, 0x38, 0x67, - 0xae, 0xcd, 0x82, 0xb9, 0xe3, 0xf2, 0xf4, 0xe3, 0x38, 0x38, 0xf3, 0xb9, 0xb7, 0x3b, 0x67, 0xc1, - 0x8b, 0x19, 0x53, 0x7f, 0x4a, 0x79, 0xff, 0xbf, 0x2a, 0xcf, 0x9c, 0x51, 0xb8, 0x3b, 0xf6, 0xe6, - 0x73, 0xcf, 0x4d, 0x6f, 0xb6, 0xbf, 0x35, 0xf1, 0xbc, 0xc9, 0x8c, 0x25, 0x9b, 0xe3, 0xce, 0x9c, - 0x85, 0x9c, 0xce, 0x7d, 0x09, 0x30, 0x7e, 0x5f, 0x81, 0xba, 0xc9, 0x3e, 0x5d, 0xb0, 0x90, 0x93, - 0x6d, 0xa8, 0xb0, 0xf1, 0xd4, 0xeb, 0x95, 0x6e, 0x6a, 0xdb, 0xcd, 0x3d, 0x32, 0x90, 0x0b, 0x29, - 0xe9, 0xa3, 0xf1, 0xd4, 0x3b, 0x5c, 0x33, 0x11, 0x41, 0xde, 0x81, 0xea, 0xf3, 0xd9, 0x22, 0x9c, - 0xf6, 0xca, 0x08, 0xbd, 0x9c, 0x85, 0xfe, 0x48, 0x88, 0x0e, 0xd7, 0x4c, 0x89, 0x11, 0xcb, 0x3a, - 0xee, 0x73, 0xaf, 0x57, 0x29, 0x5a, 0xf6, 0xc8, 0x7d, 0x8e, 0xcb, 0x0a, 0x04, 0xd9, 0x07, 0x08, - 0x19, 0xb7, 0x3c, 0x9f, 0x3b, 0x9e, 0xdb, 0xab, 0x22, 0xfe, 0x5a, 0x16, 0xff, 0x84, 0xf1, 0x9f, - 0xa2, 0xf8, 0x70, 0xcd, 0xd4, 0xc3, 0x68, 0x20, 0x34, 0x1d, 0xd7, 0xe1, 0xd6, 0x78, 0x4a, 0x1d, - 0xb7, 0x57, 0x2b, 0xd2, 0x3c, 0x72, 0x1d, 0xfe, 0x40, 0x88, 0x85, 0xa6, 0x13, 0x0d, 0xc4, 0x51, - 0x3e, 0x5d, 0xb0, 0xe0, 0xac, 0x57, 0x2f, 0x3a, 0xca, 0xcf, 0x84, 0x48, 0x1c, 0x05, 0x31, 0xe4, - 0x3e, 0x34, 0x47, 0x6c, 0xe2, 0xb8, 0xd6, 0x68, 0xe6, 0x8d, 0x5f, 0xf4, 0x1a, 0xa8, 0xd2, 0xcb, - 0xaa, 0x0c, 0x05, 0x60, 0x28, 0xe4, 0x87, 0x6b, 0x26, 0x8c, 0xe2, 0x11, 0xd9, 0x83, 0xc6, 0x78, - 0xca, 0xc6, 0x2f, 0x2c, 0xbe, 0xec, 0xe9, 0xa8, 0x79, 0x25, 0xab, 0xf9, 0x40, 0x48, 0x9f, 0x2e, - 0x0f, 0xd7, 0xcc, 0xfa, 0x58, 0x3e, 0x92, 0xbb, 0xa0, 0x33, 0xd7, 0x56, 0xaf, 0x6b, 0xa2, 0xd2, - 0xd5, 0xdc, 0x77, 0x71, 0xed, 0xe8, 0x65, 0x0d, 0xa6, 0x9e, 0xc9, 0x00, 0x6a, 0xc2, 0x19, 0x1c, - 0xde, 0x5b, 0x47, 0x9d, 0x8d, 0xdc, 0x8b, 0x50, 0x76, 0xb8, 0x66, 0x2a, 0x94, 0x30, 0x9f, 0xcd, - 0x66, 0xce, 0x29, 0x0b, 0xc4, 0xe6, 0x2e, 0x17, 0x99, 0xef, 0xa1, 0x94, 0xe3, 0xf6, 0x74, 0x3b, - 0x1a, 0x0c, 0xeb, 0x50, 0x3d, 0xa5, 0xb3, 0x05, 0x33, 0xde, 0x82, 0x66, 0xca, 0x53, 0x48, 0x0f, - 0xea, 0x73, 0x16, 0x86, 0x74, 0xc2, 0x7a, 0xda, 0x4d, 0x6d, 0x5b, 0x37, 0xa3, 0xa1, 0xd1, 0x86, - 0xf5, 0xb4, 0x9f, 0x18, 0xf3, 0x58, 0x51, 0xf8, 0x82, 0x50, 0x3c, 0x65, 0x41, 0x28, 0x1c, 0x40, - 0x29, 0xaa, 0x21, 0xb9, 0x05, 0x2d, 0xb4, 0x83, 0x15, 0xc9, 0x85, 0x9f, 0x56, 0xcc, 0x75, 0x9c, - 0x3c, 0x51, 0xa0, 0x2d, 0x68, 0xfa, 0x7b, 0x7e, 0x0c, 0x29, 0x23, 0x04, 0xfc, 0x3d, 0x5f, 0x01, - 0x8c, 0x1f, 0x40, 0x37, 0xef, 0x4a, 0xa4, 0x0b, 0xe5, 0x17, 0xec, 0x4c, 0xbd, 0x4f, 0x3c, 0x92, - 0x0d, 0x75, 0x2c, 0x7c, 0x87, 0x6e, 0xaa, 0x33, 0x7e, 0x5e, 0x8a, 0x95, 0x63, 0x6f, 0x22, 0xfb, - 0x50, 0x11, 0x41, 0x85, 0xda, 0xcd, 0xbd, 0xfe, 0x40, 0x46, 0xdc, 0x20, 0x8a, 0xb8, 0xc1, 0xd3, - 0x28, 0xe2, 0x86, 0x8d, 0x2f, 0x5f, 0x6d, 0xad, 0x7d, 0xfe, 0xa7, 0x2d, 0xcd, 0x44, 0x0d, 0x72, - 0x5d, 0x38, 0x04, 0x75, 0x5c, 0xcb, 0xb1, 0xd5, 0x7b, 0xea, 0x38, 0x3e, 0xb2, 0xc9, 0x01, 0x74, - 0xc7, 0x9e, 0x1b, 0x32, 0x37, 0x5c, 0x84, 0x96, 0x4f, 0x03, 0x3a, 0x0f, 0x55, 0xac, 0x45, 0x9f, - 0xff, 0x41, 0x24, 0x3e, 0x46, 0xa9, 0xd9, 0x19, 0x67, 0x27, 0xc8, 0x87, 0x00, 0xa7, 0x74, 0xe6, - 0xd8, 0x94, 0x7b, 0x41, 0xd8, 0xab, 0xdc, 0x2c, 0xa7, 0x94, 0x4f, 0x22, 0xc1, 0x33, 0xdf, 0xa6, - 0x9c, 0x0d, 0x2b, 0x62, 0x67, 0x66, 0x0a, 0x4f, 0x6e, 0x43, 0x87, 0xfa, 0xbe, 0x15, 0x72, 0xca, - 0x99, 0x35, 0x3a, 0xe3, 0x2c, 0xc4, 0x78, 0x5c, 0x37, 0x5b, 0xd4, 0xf7, 0x9f, 0x88, 0xd9, 0xa1, - 0x98, 0x34, 0xec, 0xf8, 0x6b, 0x62, 0xa8, 0x10, 0x02, 0x15, 0x9b, 0x72, 0x8a, 0xd6, 0x58, 0x37, - 0xf1, 0x59, 0xcc, 0xf9, 0x94, 0x4f, 0xd5, 0x19, 0xf1, 0x99, 0x5c, 0x85, 0xda, 0x94, 0x39, 0x93, - 0x29, 0xc7, 0x63, 0x95, 0x4d, 0x35, 0x12, 0x86, 0xf7, 0x03, 0xef, 0x94, 0x61, 0xb6, 0x68, 0x98, - 0x72, 0x60, 0xfc, 0x4d, 0x83, 0x4b, 0x17, 0xc2, 0x4b, 0xac, 0x3b, 0xa5, 0xe1, 0x34, 0x7a, 0x97, - 0x78, 0x26, 0xef, 0x88, 0x75, 0xa9, 0xcd, 0x02, 0x95, 0xc5, 0x5a, 0xea, 0xc4, 0x87, 0x38, 0xa9, - 0x0e, 0xaa, 0x20, 0xe4, 0x11, 0x74, 0x67, 0x34, 0xe4, 0x96, 0x8c, 0x02, 0x0b, 0xb3, 0x54, 0x39, - 0x13, 0x99, 0x8f, 0x69, 0x14, 0x2d, 0xc2, 0x39, 0x95, 0x7a, 0x7b, 0x96, 0x99, 0x25, 0x87, 0xb0, - 0x31, 0x3a, 0xfb, 0x25, 0x75, 0xb9, 0xe3, 0x32, 0xeb, 0x82, 0xcd, 0x3b, 0x6a, 0xa9, 0x47, 0xa7, - 0x8e, 0xcd, 0xdc, 0x71, 0x64, 0xec, 0xcb, 0xb1, 0x4a, 0xfc, 0x31, 0x42, 0xe3, 0x10, 0xda, 0xd9, - 0x5c, 0x40, 0xda, 0x50, 0xe2, 0x4b, 0x75, 0xc2, 0x12, 0x5f, 0x92, 0xdb, 0x50, 0x11, 0xcb, 0xe1, - 0xe9, 0xda, 0x71, 0x32, 0x55, 0xe8, 0xa7, 0x67, 0x3e, 0x33, 0x51, 0x6e, 0x18, 0xb1, 0xa7, 0xc6, - 0x81, 0x9b, 0x5f, 0xcb, 0xd8, 0x81, 0x4e, 0x2e, 0x89, 0xa4, 0x3e, 0x8b, 0x96, 0xfe, 0x2c, 0x46, - 0x07, 0x5a, 0x99, 0xdc, 0x61, 0x7c, 0x56, 0x85, 0x86, 0xc9, 0x42, 0x5f, 0x38, 0x1d, 0xd9, 0x07, - 0x9d, 0x2d, 0xc7, 0x4c, 0xa6, 0x6d, 0x2d, 0x97, 0x14, 0x25, 0xe6, 0x51, 0x24, 0x17, 0xe9, 0x23, - 0x06, 0x93, 0x9d, 0x0c, 0xe5, 0x5c, 0xce, 0x2b, 0xa5, 0x39, 0xe7, 0x4e, 0x96, 0x73, 0x36, 0x72, - 0xd8, 0x1c, 0xe9, 0xec, 0x64, 0x48, 0x27, 0xbf, 0x70, 0x86, 0x75, 0xee, 0x15, 0xb0, 0x4e, 0x7e, - 0xfb, 0x2b, 0x68, 0xe7, 0x5e, 0x01, 0xed, 0xf4, 0x2e, 0xbc, 0xab, 0x90, 0x77, 0xee, 0x64, 0x79, - 0x27, 0x7f, 0x9c, 0x1c, 0xf1, 0x7c, 0x58, 0x44, 0x3c, 0xd7, 0x73, 0x3a, 0x2b, 0x99, 0xe7, 0x83, - 0x0b, 0xcc, 0x73, 0x35, 0xa7, 0x5a, 0x40, 0x3d, 0xf7, 0x32, 0x9c, 0x00, 0x85, 0x67, 0x2b, 0x26, - 0x05, 0xf2, 0xfd, 0x8b, 0xac, 0x75, 0x2d, 0xff, 0x69, 0x8b, 0x68, 0x6b, 0x37, 0x47, 0x5b, 0x57, - 0xf2, 0xbb, 0xcc, 0xf1, 0x56, 0xc2, 0x3e, 0x3b, 0x22, 0x3f, 0xe4, 0x3c, 0x4d, 0xe4, 0x12, 0x16, - 0x04, 0x5e, 0xa0, 0x12, 0xbb, 0x1c, 0x18, 0xdb, 0x22, 0x63, 0x25, 0xfe, 0xf5, 0x1a, 0xa6, 0x42, - 0xa7, 0x4f, 0x79, 0x97, 0xf1, 0x85, 0x96, 0xe8, 0x62, 0xe4, 0xa7, 0xb3, 0x9d, 0xae, 0xb2, 0x5d, - 0x8a, 0xc0, 0x4a, 0x59, 0x02, 0xdb, 0x82, 0xa6, 0xc8, 0xa9, 0x39, 0x6e, 0xa2, 0x7e, 0xc4, 0x4d, - 0xe4, 0x6d, 0xb8, 0x84, 0xf9, 0x48, 0xd2, 0x9c, 0x0a, 0xc4, 0x0a, 0x06, 0x62, 0x47, 0x08, 0xa4, - 0xc5, 0x64, 0xa2, 0x7c, 0x17, 0x2e, 0xa7, 0xb0, 0x62, 0x5d, 0xcc, 0x85, 0x32, 0x49, 0x77, 0x63, - 0xf4, 0x81, 0xef, 0x1f, 0xd2, 0x70, 0x6a, 0xfc, 0x24, 0x31, 0x50, 0xc2, 0x7b, 0x04, 0x2a, 0x63, - 0xcf, 0x96, 0xe7, 0x6e, 0x99, 0xf8, 0x2c, 0xb8, 0x70, 0xe6, 0x4d, 0x70, 0x73, 0xba, 0x29, 0x1e, - 0x05, 0x2a, 0x0e, 0x25, 0x5d, 0xc6, 0x8c, 0xf1, 0x6b, 0x2d, 0x59, 0x2f, 0xa1, 0xc2, 0x22, 0xd6, - 0xd2, 0xfe, 0x17, 0xd6, 0x2a, 0x7d, 0x3d, 0xd6, 0x32, 0xce, 0xb5, 0xe4, 0x93, 0xc5, 0x7c, 0xf4, - 0x66, 0x47, 0x14, 0xde, 0xe3, 0xb8, 0x36, 0x5b, 0xa2, 0x49, 0xcb, 0xa6, 0x1c, 0x44, 0xa5, 0x42, - 0x0d, 0xcd, 0x9c, 0x2d, 0x15, 0xea, 0x38, 0x27, 0x07, 0xe4, 0x16, 0xf2, 0x98, 0xf7, 0x5c, 0x85, - 0x6a, 0x6b, 0xa0, 0x0a, 0xfa, 0x63, 0x31, 0x69, 0x4a, 0x59, 0x2a, 0xdb, 0xea, 0x19, 0x12, 0xbc, - 0x01, 0xba, 0xd8, 0x68, 0xe8, 0xd3, 0x31, 0xc3, 0xc8, 0xd3, 0xcd, 0x64, 0xc2, 0x78, 0x0a, 0xe4, - 0x62, 0xc4, 0x93, 0x8f, 0xa0, 0xc6, 0x4e, 0x99, 0xcb, 0x85, 0xc5, 0x85, 0xd1, 0xd6, 0x63, 0xda, - 0x61, 0x2e, 0x1f, 0xf6, 0x84, 0xa9, 0xfe, 0xfe, 0x6a, 0xab, 0x2b, 0x31, 0x77, 0xbc, 0xb9, 0xc3, - 0xd9, 0xdc, 0xe7, 0x67, 0xa6, 0xd2, 0x32, 0xfe, 0xa9, 0x09, 0x36, 0xc8, 0x64, 0x83, 0x42, 0xe3, - 0x45, 0x2e, 0x5f, 0x4a, 0x11, 0xfc, 0x57, 0x33, 0xe8, 0xb7, 0x01, 0x26, 0x34, 0xb4, 0x5e, 0x52, - 0x97, 0x33, 0x5b, 0x59, 0x55, 0x9f, 0xd0, 0xf0, 0xe7, 0x38, 0x21, 0xaa, 0x21, 0x21, 0x5e, 0x84, - 0xcc, 0x46, 0xf3, 0x96, 0xcd, 0xfa, 0x84, 0x86, 0xcf, 0x42, 0x66, 0xa7, 0xce, 0x56, 0x7f, 0x93, - 0xb3, 0x65, 0xed, 0xd9, 0xc8, 0xdb, 0xf3, 0xdf, 0x29, 0x5f, 0x4e, 0xc8, 0xf2, 0x9b, 0x71, 0xf6, - 0x7f, 0x68, 0xa2, 0x4e, 0xc8, 0xa6, 0x64, 0x72, 0x04, 0x97, 0xe2, 0x98, 0xb2, 0x16, 0x18, 0x6b, - 0x91, 0x57, 0xbd, 0x3e, 0x14, 0xbb, 0xa7, 0xd9, 0xe9, 0x90, 0x7c, 0x02, 0xd7, 0x72, 0x19, 0x21, - 0x5e, 0xb0, 0xf4, 0xda, 0xc4, 0x70, 0x25, 0x9b, 0x18, 0xa2, 0xf5, 0x12, 0x6b, 0x94, 0xdf, 0xc8, - 0xcb, 0xbf, 0x23, 0x0a, 0xac, 0x34, 0x99, 0x14, 0x7d, 0x53, 0xe3, 0x37, 0x1a, 0x74, 0x72, 0x1b, - 0x22, 0xdb, 0x50, 0x95, 0x7c, 0xa6, 0x65, 0xda, 0x58, 0xb4, 0x98, 0xda, 0xb3, 0x04, 0x90, 0xf7, - 0xa1, 0xc1, 0x54, 0xad, 0xa7, 0x0e, 0x79, 0x25, 0x57, 0x02, 0x2a, 0x7c, 0x0c, 0x23, 0xdf, 0x03, - 0x3d, 0x36, 0x5d, 0xae, 0xce, 0x8f, 0x2d, 0xad, 0x94, 0x12, 0xa0, 0xf1, 0x00, 0x9a, 0xa9, 0xd7, - 0x93, 0x6f, 0x81, 0x3e, 0xa7, 0x4b, 0x55, 0xac, 0xcb, 0xf2, 0xad, 0x31, 0xa7, 0x4b, 0xac, 0xd3, - 0xc9, 0x35, 0xa8, 0x0b, 0xe1, 0x84, 0x4a, 0xc3, 0x97, 0xcd, 0xda, 0x9c, 0x2e, 0x7f, 0x4c, 0x43, - 0x63, 0x07, 0xda, 0xd9, 0x6d, 0x45, 0xd0, 0x88, 0x10, 0x25, 0xf4, 0x60, 0xc2, 0x8c, 0xbb, 0xd0, - 0xc9, 0xed, 0x86, 0x18, 0xd0, 0xf2, 0x17, 0x23, 0xeb, 0x05, 0x3b, 0xb3, 0x70, 0xbb, 0xe8, 0x26, - 0xba, 0xd9, 0xf4, 0x17, 0xa3, 0x8f, 0xd9, 0x99, 0xa8, 0x47, 0x43, 0xe3, 0x09, 0xb4, 0xb3, 0x65, - 0xb4, 0x48, 0x99, 0x81, 0xb7, 0x70, 0x6d, 0x5c, 0xbf, 0x6a, 0xca, 0x81, 0xe8, 0xc4, 0x4f, 0x3d, - 0xe9, 0x19, 0xe9, 0xba, 0xf9, 0xc4, 0xe3, 0x2c, 0x55, 0x7c, 0x4b, 0x8c, 0xe1, 0x40, 0x15, 0xbf, - 0xb9, 0xf8, 0x7e, 0x58, 0x10, 0x2b, 0x0a, 0x16, 0xcf, 0xe4, 0x31, 0x00, 0xe5, 0x3c, 0x70, 0x46, - 0x8b, 0x64, 0xb9, 0xf6, 0x40, 0x5e, 0x8f, 0x0c, 0x3e, 0x3e, 0x39, 0xa6, 0x4e, 0x30, 0xbc, 0xa1, - 0x7c, 0x65, 0x23, 0x41, 0xa6, 0xfc, 0x25, 0xa5, 0x6f, 0xfc, 0xaa, 0x0a, 0x35, 0xd9, 0x3e, 0x90, - 0x41, 0xb6, 0x39, 0x15, 0xab, 0xaa, 0x4d, 0xca, 0x59, 0xb5, 0xc7, 0x98, 0xf1, 0x6f, 0xe7, 0x3b, - 0xbc, 0x61, 0xf3, 0xfc, 0xd5, 0x56, 0x1d, 0xd9, 0xf2, 0xe8, 0x61, 0xd2, 0xee, 0xad, 0xea, 0x86, - 0xa2, 0xde, 0xb2, 0xf2, 0xb5, 0x7b, 0xcb, 0x6b, 0x50, 0x77, 0x17, 0x73, 0x8b, 0x2f, 0x43, 0x95, - 0x6d, 0x6a, 0xee, 0x62, 0xfe, 0x74, 0x89, 0x5e, 0xc2, 0x3d, 0x4e, 0x67, 0x28, 0x92, 0xb9, 0xa6, - 0x81, 0x13, 0x42, 0xb8, 0x0f, 0xad, 0x54, 0x51, 0xe1, 0xd8, 0xaa, 0x38, 0x6d, 0xa7, 0x9d, 0xfd, - 0xe8, 0xa1, 0x3a, 0x65, 0x33, 0x2e, 0x32, 0x8e, 0x6c, 0xb2, 0x9d, 0x6d, 0xa5, 0xb0, 0x16, 0x69, - 0x60, 0x48, 0xa5, 0xba, 0x25, 0x51, 0x89, 0x88, 0x0d, 0x88, 0x20, 0x93, 0x10, 0x1d, 0x21, 0x0d, - 0x31, 0x81, 0xc2, 0xb7, 0xa0, 0x93, 0xd0, 0xb9, 0x84, 0x80, 0x5c, 0x25, 0x99, 0x46, 0xe0, 0x7b, - 0xb0, 0xe1, 0xb2, 0x25, 0xb7, 0xf2, 0xe8, 0x26, 0xa2, 0x89, 0x90, 0x9d, 0x64, 0x35, 0xbe, 0x0b, - 0xed, 0x24, 0x15, 0x21, 0x76, 0x5d, 0x36, 0xb4, 0xf1, 0x2c, 0xc2, 0xae, 0x43, 0x23, 0x2e, 0xa6, - 0x5a, 0x08, 0xa8, 0x53, 0x59, 0x43, 0xc5, 0xe5, 0x59, 0xc0, 0xc2, 0xc5, 0x8c, 0xab, 0x45, 0xda, - 0x88, 0xc1, 0xf2, 0xcc, 0x94, 0xf3, 0x88, 0xbd, 0x05, 0xad, 0x28, 0xba, 0x25, 0xae, 0x83, 0xb8, - 0xf5, 0x68, 0x12, 0x41, 0x3b, 0xd0, 0xf5, 0x03, 0xcf, 0xf7, 0x42, 0x16, 0x58, 0xd4, 0xb6, 0x03, - 0x16, 0x86, 0xbd, 0xae, 0x5c, 0x2f, 0x9a, 0x3f, 0x90, 0xd3, 0xc6, 0xfb, 0x50, 0x8f, 0xaa, 0xc4, - 0x0d, 0xa8, 0x0e, 0xe3, 0x4c, 0x54, 0x31, 0xe5, 0x40, 0xf0, 0xd0, 0x81, 0xef, 0xab, 0x3b, 0x11, - 0xf1, 0x68, 0xfc, 0x02, 0xea, 0xea, 0x83, 0x15, 0x76, 0xca, 0x3f, 0x84, 0x75, 0x9f, 0x06, 0xe2, - 0x18, 0xe9, 0x7e, 0x39, 0xea, 0x43, 0x8e, 0x69, 0xc0, 0x9f, 0x30, 0x9e, 0x69, 0x9b, 0x9b, 0x88, - 0x97, 0x53, 0xc6, 0x3d, 0x68, 0x65, 0x30, 0x62, 0x5b, 0xe8, 0x47, 0x51, 0x50, 0xe3, 0x20, 0x7e, - 0x73, 0x29, 0x79, 0xb3, 0x71, 0x1f, 0xf4, 0xf8, 0xdb, 0x88, 0x72, 0x39, 0x3a, 0xba, 0xa6, 0xcc, - 0x2d, 0x87, 0x78, 0x15, 0xe0, 0xbd, 0x64, 0x81, 0x8a, 0x09, 0x39, 0x30, 0x9e, 0xa5, 0x92, 0x90, - 0x64, 0x05, 0x72, 0x07, 0xea, 0x2a, 0x09, 0xa9, 0xa8, 0x8c, 0x9a, 0xfe, 0x63, 0xcc, 0x42, 0x51, - 0xd3, 0x2f, 0x73, 0x52, 0xb2, 0x6c, 0x29, 0xbd, 0xec, 0x0c, 0x1a, 0x51, 0xa2, 0xc9, 0x66, 0x63, - 0xb9, 0x62, 0x37, 0x9f, 0x8d, 0xd5, 0xa2, 0x09, 0x50, 0x78, 0x47, 0xe8, 0x4c, 0x5c, 0x66, 0x5b, - 0x49, 0x08, 0xe1, 0x3b, 0x1a, 0x66, 0x47, 0x0a, 0x1e, 0x47, 0xf1, 0x62, 0xbc, 0x07, 0x35, 0xb9, - 0xb7, 0xc2, 0xf4, 0x55, 0x44, 0x49, 0x7f, 0xd4, 0xa0, 0x11, 0xe5, 0xe9, 0x42, 0xa5, 0xcc, 0xa6, - 0x4b, 0x5f, 0x75, 0xd3, 0xff, 0xff, 0xc4, 0x73, 0x07, 0x88, 0xcc, 0x2f, 0xa7, 0x1e, 0x77, 0xdc, - 0x89, 0x25, 0x6d, 0x2d, 0x73, 0x50, 0x17, 0x25, 0x27, 0x28, 0x38, 0x16, 0xf3, 0x6f, 0xdf, 0x82, - 0x66, 0xea, 0xee, 0x82, 0xd4, 0xa1, 0xfc, 0x09, 0x7b, 0xd9, 0x5d, 0x23, 0x4d, 0xa8, 0x9b, 0x0c, - 0x3b, 0xd1, 0xae, 0xb6, 0xf7, 0x59, 0x15, 0x3a, 0x07, 0xc3, 0x07, 0x47, 0x07, 0xbe, 0x3f, 0x73, - 0xc6, 0x14, 0x5b, 0x97, 0x5d, 0xa8, 0x60, 0xf7, 0x56, 0x70, 0x4b, 0xdd, 0x2f, 0xba, 0x46, 0x20, - 0x7b, 0x50, 0xc5, 0x26, 0x8e, 0x14, 0x5d, 0x56, 0xf7, 0x0b, 0x6f, 0x13, 0xc4, 0x4b, 0x64, 0x9b, - 0x77, 0xf1, 0xce, 0xba, 0x5f, 0x74, 0xa5, 0x40, 0x3e, 0x02, 0x3d, 0xe9, 0xae, 0x56, 0xdd, 0x5c, - 0xf7, 0x57, 0x5e, 0x2e, 0x08, 0xfd, 0xa4, 0x02, 0x5d, 0x75, 0x01, 0xdb, 0x5f, 0xd9, 0x85, 0x93, - 0x7d, 0xa8, 0x47, 0xb5, 0x7b, 0xf1, 0xdd, 0x72, 0x7f, 0x45, 0xe3, 0x2f, 0xcc, 0x23, 0x1b, 0xa6, - 0xa2, 0x0b, 0xf0, 0x7e, 0xe1, 0xed, 0x04, 0xb9, 0x0b, 0x35, 0x55, 0x44, 0x15, 0xde, 0x2f, 0xf7, - 0x8b, 0xdb, 0x77, 0x71, 0xc8, 0xa4, 0x65, 0x5c, 0x75, 0x49, 0xdf, 0x5f, 0x79, 0x8d, 0x42, 0x0e, - 0x00, 0x52, 0x7d, 0xcf, 0xca, 0xdb, 0xf7, 0xfe, 0xea, 0xeb, 0x11, 0x72, 0x1f, 0x1a, 0xc9, 0x95, - 0x57, 0xf1, 0x7d, 0x7a, 0x7f, 0xd5, 0x8d, 0xc5, 0xf0, 0xc6, 0xbf, 0xfe, 0xb2, 0xa9, 0xfd, 0xf6, - 0x7c, 0x53, 0xfb, 0xe2, 0x7c, 0x53, 0xfb, 0xf2, 0x7c, 0x53, 0xfb, 0xc3, 0xf9, 0xa6, 0xf6, 0xe7, - 0xf3, 0x4d, 0xed, 0x77, 0x7f, 0xdd, 0xd4, 0x46, 0x35, 0x8c, 0x91, 0x0f, 0xfe, 0x13, 0x00, 0x00, - 0xff, 0xff, 0x92, 0xed, 0x9f, 0xca, 0x3f, 0x1a, 0x00, 0x00, -} diff --git a/abci/types/types.proto b/abci/types/types.proto index 8f9dda832..1c72a8573 100644 --- a/abci/types/types.proto +++ b/abci/types/types.proto @@ -256,26 +256,24 @@ message Header { string chain_id = 2 [(gogoproto.customname)="ChainID"]; int64 height = 3; google.protobuf.Timestamp time = 4 [(gogoproto.nullable)=false, (gogoproto.stdtime)=true]; - int64 num_txs = 5; - int64 total_txs = 6; // prev block info - BlockID last_block_id = 7 [(gogoproto.nullable)=false]; + BlockID last_block_id = 5 [(gogoproto.nullable)=false]; // hashes of block data - bytes last_commit_hash = 8; // commit from validators from the last block - bytes data_hash = 9; // transactions + bytes last_commit_hash = 6; // commit from validators from the last block + bytes data_hash = 7; // transactions // hashes from the app output from the prev block - bytes validators_hash = 10; // validators for the current block - bytes next_validators_hash = 11; // validators for the next block - bytes consensus_hash = 12; // consensus params for current block - bytes app_hash = 13; // state after txs from the previous block - bytes last_results_hash = 14;// root hash of all results from the txs from the previous block + bytes validators_hash = 8; // validators for the current block + bytes next_validators_hash = 9; // validators for the next block + bytes consensus_hash = 10; // consensus params for current block + bytes app_hash = 11; // state after txs from the previous block + bytes last_results_hash = 12;// root hash of all results from the txs from the previous block // consensus info - bytes evidence_hash = 15; // evidence included in the block - bytes proposer_address = 16; // original proposer of the block + bytes evidence_hash = 13; // evidence included in the block + bytes proposer_address = 14; // original proposer of the block } message Version { diff --git a/abci/types/typespb_test.go b/abci/types/typespb_test.go index 523561532..e900d3841 100644 --- a/abci/types/typespb_test.go +++ b/abci/types/typespb_test.go @@ -3,19 +3,21 @@ package types -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import proto "github.com/gogo/protobuf/proto" -import golang_proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" -import _ "github.com/golang/protobuf/ptypes/timestamp" -import _ "github.com/tendermint/tendermint/crypto/merkle" -import _ "github.com/tendermint/tendermint/libs/common" +import ( + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" + github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" + proto "github.com/gogo/protobuf/proto" + golang_proto "github.com/golang/protobuf/proto" + _ "github.com/golang/protobuf/ptypes/timestamp" + _ "github.com/tendermint/tendermint/crypto/merkle" + _ "github.com/tendermint/tendermint/libs/common" + math "math" + math_rand "math/rand" + testing "testing" + time "time" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal diff --git a/behaviour/reporter.go b/behaviour/reporter.go index f8a0693bf..0a1467168 100644 --- a/behaviour/reporter.go +++ b/behaviour/reporter.go @@ -63,10 +63,12 @@ func NewMockReporter() *MockReporter { } // Report stores the PeerBehaviour produced by the peer identified by peerID. -func (mpbr *MockReporter) Report(behaviour PeerBehaviour) { +func (mpbr *MockReporter) Report(behaviour PeerBehaviour) error { mpbr.mtx.Lock() defer mpbr.mtx.Unlock() mpbr.pb[behaviour.peerID] = append(mpbr.pb[behaviour.peerID], behaviour) + + return nil } // GetBehaviours returns all behaviours reported on the peer identified by peerID. diff --git a/behaviour/reporter_test.go b/behaviour/reporter_test.go index eae94e7bd..9822cfc6d 100644 --- a/behaviour/reporter_test.go +++ b/behaviour/reporter_test.go @@ -131,9 +131,24 @@ func TestMockPeerBehaviourReporterConcurrency(t *testing.T) { }{ {"1", []bh.PeerBehaviour{bh.ConsensusVote("1", "")}}, {"2", []bh.PeerBehaviour{bh.ConsensusVote("2", ""), bh.ConsensusVote("2", ""), bh.ConsensusVote("2", "")}}, - {"3", []bh.PeerBehaviour{bh.BlockPart("3", ""), bh.ConsensusVote("3", ""), bh.BlockPart("3", ""), bh.ConsensusVote("3", "")}}, - {"4", []bh.PeerBehaviour{bh.ConsensusVote("4", ""), bh.ConsensusVote("4", ""), bh.ConsensusVote("4", ""), bh.ConsensusVote("4", "")}}, - {"5", []bh.PeerBehaviour{bh.BlockPart("5", ""), bh.ConsensusVote("5", ""), bh.BlockPart("5", ""), bh.ConsensusVote("5", "")}}, + { + "3", + []bh.PeerBehaviour{bh.BlockPart("3", ""), + bh.ConsensusVote("3", ""), + bh.BlockPart("3", ""), + bh.ConsensusVote("3", "")}}, + { + "4", + []bh.PeerBehaviour{bh.ConsensusVote("4", ""), + bh.ConsensusVote("4", ""), + bh.ConsensusVote("4", ""), + bh.ConsensusVote("4", "")}}, + { + "5", + []bh.PeerBehaviour{bh.BlockPart("5", ""), + bh.ConsensusVote("5", ""), + bh.BlockPart("5", ""), + bh.ConsensusVote("5", "")}}, } ) diff --git a/benchmarks/atomic_test.go b/benchmarks/atomic_test.go deleted file mode 100644 index 5fe4832df..000000000 --- a/benchmarks/atomic_test.go +++ /dev/null @@ -1,29 +0,0 @@ -package benchmarks - -import ( - "sync/atomic" - "testing" - "unsafe" -) - -func BenchmarkAtomicUintPtr(b *testing.B) { - b.StopTimer() - pointers := make([]uintptr, 1000) - b.Log(unsafe.Sizeof(pointers[0])) - b.StartTimer() - - for j := 0; j < b.N; j++ { - atomic.StoreUintptr(&pointers[j%1000], uintptr(j)) - } -} - -func BenchmarkAtomicPointer(b *testing.B) { - b.StopTimer() - pointers := make([]unsafe.Pointer, 1000) - b.Log(unsafe.Sizeof(pointers[0])) - b.StartTimer() - - for j := 0; j < b.N; j++ { - atomic.StorePointer(&pointers[j%1000], unsafe.Pointer(uintptr(j))) - } -} diff --git a/benchmarks/blockchain/.gitignore b/benchmarks/blockchain/.gitignore deleted file mode 100644 index 9e67bd47d..000000000 --- a/benchmarks/blockchain/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -data - diff --git a/benchmarks/blockchain/localsync.sh b/benchmarks/blockchain/localsync.sh deleted file mode 100755 index 2dc3e49c0..000000000 --- a/benchmarks/blockchain/localsync.sh +++ /dev/null @@ -1,80 +0,0 @@ -#!/bin/bash - -DATA=$GOPATH/src/github.com/tendermint/tendermint/benchmarks/blockchain/data -if [ ! -d $DATA ]; then - echo "no data found, generating a chain... (this only has to happen once)" - - tendermint init --home $DATA - cp $DATA/config.toml $DATA/config2.toml - echo " - [consensus] - timeout_commit = 0 - " >> $DATA/config.toml - - echo "starting node" - tendermint node \ - --home $DATA \ - --proxy_app kvstore \ - --p2p.laddr tcp://127.0.0.1:56656 \ - --rpc.laddr tcp://127.0.0.1:56657 \ - --log_level error & - - echo "making blocks for 60s" - sleep 60 - - mv $DATA/config2.toml $DATA/config.toml - - kill %1 - - echo "done generating chain." -fi - -# validator node -HOME1=$TMPDIR$RANDOM$RANDOM -cp -R $DATA $HOME1 -echo "starting validator node" -tendermint node \ - --home $HOME1 \ - --proxy_app kvstore \ - --p2p.laddr tcp://127.0.0.1:56656 \ - --rpc.laddr tcp://127.0.0.1:56657 \ - --log_level error & -sleep 1 - -# downloader node -HOME2=$TMPDIR$RANDOM$RANDOM -tendermint init --home $HOME2 -cp $HOME1/genesis.json $HOME2 -printf "starting downloader node" -tendermint node \ - --home $HOME2 \ - --proxy_app kvstore \ - --p2p.laddr tcp://127.0.0.1:56666 \ - --rpc.laddr tcp://127.0.0.1:56667 \ - --p2p.persistent_peers 127.0.0.1:56656 \ - --log_level error & - -# wait for node to start up so we only count time where we are actually syncing -sleep 0.5 -while curl localhost:56667/status 2> /dev/null | grep "\"latest_block_height\": 0," > /dev/null -do - printf '.' - sleep 0.2 -done -echo - -echo "syncing blockchain for 10s" -for i in {1..10} -do - sleep 1 - HEIGHT="$(curl localhost:56667/status 2> /dev/null \ - | grep 'latest_block_height' \ - | grep -o ' [0-9]*' \ - | xargs)" - let 'RATE = HEIGHT / i' - echo "height: $HEIGHT, blocks/sec: $RATE" -done - -kill %1 -kill %2 -rm -rf $HOME1 $HOME2 diff --git a/benchmarks/chan_test.go b/benchmarks/chan_test.go deleted file mode 100644 index 78b70c9be..000000000 --- a/benchmarks/chan_test.go +++ /dev/null @@ -1,19 +0,0 @@ -package benchmarks - -import ( - "testing" -) - -func BenchmarkChanMakeClose(b *testing.B) { - b.StopTimer() - b.StartTimer() - - for j := 0; j < b.N; j++ { - foo := make(chan struct{}) - close(foo) - something, ok := <-foo - if ok { - b.Error(something, ok) - } - } -} diff --git a/benchmarks/codec_test.go b/benchmarks/codec_test.go deleted file mode 100644 index 64c0e72cf..000000000 --- a/benchmarks/codec_test.go +++ /dev/null @@ -1,123 +0,0 @@ -package benchmarks - -import ( - "testing" - "time" - - amino "github.com/tendermint/go-amino" - - proto "github.com/tendermint/tendermint/benchmarks/proto" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/p2p" - ctypes "github.com/tendermint/tendermint/rpc/core/types" -) - -func testNodeInfo(id p2p.ID) p2p.DefaultNodeInfo { - return p2p.DefaultNodeInfo{ - ProtocolVersion: p2p.ProtocolVersion{P2P: 1, Block: 2, App: 3}, - ID_: id, - Moniker: "SOMENAME", - Network: "SOMENAME", - ListenAddr: "SOMEADDR", - Version: "SOMEVER", - Other: p2p.DefaultNodeInfoOther{ - TxIndex: "on", - RPCAddress: "0.0.0.0:26657", - }, - } -} - -func BenchmarkEncodeStatusWire(b *testing.B) { - b.StopTimer() - cdc := amino.NewCodec() - ctypes.RegisterAmino(cdc) - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - status := &ctypes.ResultStatus{ - NodeInfo: testNodeInfo(nodeKey.ID()), - SyncInfo: ctypes.SyncInfo{ - LatestBlockHash: []byte("SOMEBYTES"), - LatestBlockHeight: 123, - LatestBlockTime: time.Unix(0, 1234), - }, - ValidatorInfo: ctypes.ValidatorInfo{ - PubKey: nodeKey.PubKey(), - }, - } - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - jsonBytes, err := cdc.MarshalJSON(status) - if err != nil { - panic(err) - } - counter += len(jsonBytes) - } - -} - -func BenchmarkEncodeNodeInfoWire(b *testing.B) { - b.StopTimer() - cdc := amino.NewCodec() - ctypes.RegisterAmino(cdc) - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - nodeInfo := testNodeInfo(nodeKey.ID()) - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - jsonBytes, err := cdc.MarshalJSON(nodeInfo) - if err != nil { - panic(err) - } - counter += len(jsonBytes) - } -} - -func BenchmarkEncodeNodeInfoBinary(b *testing.B) { - b.StopTimer() - cdc := amino.NewCodec() - ctypes.RegisterAmino(cdc) - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - nodeInfo := testNodeInfo(nodeKey.ID()) - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - jsonBytes := cdc.MustMarshalBinaryBare(nodeInfo) - counter += len(jsonBytes) - } - -} - -func BenchmarkEncodeNodeInfoProto(b *testing.B) { - b.StopTimer() - nodeKey := p2p.NodeKey{PrivKey: ed25519.GenPrivKey()} - nodeID := string(nodeKey.ID()) - someName := "SOMENAME" - someAddr := "SOMEADDR" - someVer := "SOMEVER" - someString := "SOMESTRING" - otherString := "OTHERSTRING" - nodeInfo := proto.NodeInfo{ - Id: &proto.ID{Id: &nodeID}, - Moniker: &someName, - Network: &someName, - ListenAddr: &someAddr, - Version: &someVer, - Other: []string{someString, otherString}, - } - b.StartTimer() - - counter := 0 - for i := 0; i < b.N; i++ { - bytes, err := nodeInfo.Marshal() - if err != nil { - b.Fatal(err) - return - } - //jsonBytes := wire.JSONBytes(nodeInfo) - counter += len(bytes) - } - -} diff --git a/benchmarks/empty.go b/benchmarks/empty.go deleted file mode 100644 index 20f08f14b..000000000 --- a/benchmarks/empty.go +++ /dev/null @@ -1 +0,0 @@ -package benchmarks diff --git a/benchmarks/map_test.go b/benchmarks/map_test.go deleted file mode 100644 index d13a19edf..000000000 --- a/benchmarks/map_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package benchmarks - -import ( - "testing" - - cmn "github.com/tendermint/tendermint/libs/common" -) - -func BenchmarkSomething(b *testing.B) { - b.StopTimer() - numItems := 100000 - numChecks := 100000 - keys := make([]string, numItems) - for i := 0; i < numItems; i++ { - keys[i] = cmn.RandStr(100) - } - txs := make([]string, numChecks) - for i := 0; i < numChecks; i++ { - txs[i] = cmn.RandStr(100) - } - b.StartTimer() - - counter := 0 - for j := 0; j < b.N; j++ { - foo := make(map[string]string) - for _, key := range keys { - foo[key] = key - } - for _, tx := range txs { - if _, ok := foo[tx]; ok { - counter++ - } - } - } -} diff --git a/benchmarks/os_test.go b/benchmarks/os_test.go deleted file mode 100644 index 406038b9d..000000000 --- a/benchmarks/os_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package benchmarks - -import ( - "os" - "testing" - - cmn "github.com/tendermint/tendermint/libs/common" -) - -func BenchmarkFileWrite(b *testing.B) { - b.StopTimer() - file, err := os.OpenFile("benchmark_file_write.out", - os.O_RDWR|os.O_CREATE|os.O_APPEND, 0600) - if err != nil { - b.Error(err) - } - testString := cmn.RandStr(200) + "\n" - b.StartTimer() - - for i := 0; i < b.N; i++ { - _, err := file.Write([]byte(testString)) - if err != nil { - b.Error(err) - } - } - - if err := file.Close(); err != nil { - b.Error(err) - } - if err := os.Remove("benchmark_file_write.out"); err != nil { - b.Error(err) - } -} diff --git a/benchmarks/proto/README b/benchmarks/proto/README deleted file mode 100644 index 87ece2576..000000000 --- a/benchmarks/proto/README +++ /dev/null @@ -1,2 +0,0 @@ -Doing some protobuf tests here. -Using gogoprotobuf. diff --git a/benchmarks/proto/test.pb.go b/benchmarks/proto/test.pb.go deleted file mode 100644 index d430eeb08..000000000 --- a/benchmarks/proto/test.pb.go +++ /dev/null @@ -1,1456 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: test.proto - -/* - Package test is a generated protocol buffer package. - - It is generated from these files: - test.proto - - It has these top-level messages: - ResultStatus - NodeInfo - ID - PubKey - PubKeyEd25519 -*/ -package test - -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" - -import io "io" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package - -type ResultStatus struct { - NodeInfo *NodeInfo `protobuf:"bytes,1,opt,name=nodeInfo" json:"nodeInfo,omitempty"` - PubKey *PubKey `protobuf:"bytes,2,req,name=pubKey" json:"pubKey,omitempty"` - LatestBlockHash []byte `protobuf:"bytes,3,req,name=latestBlockHash" json:"latestBlockHash,omitempty"` - LatestBlockHeight *int64 `protobuf:"varint,4,req,name=latestBlockHeight" json:"latestBlockHeight,omitempty"` - LatestBlocktime *int64 `protobuf:"varint,5,req,name=latestBlocktime" json:"latestBlocktime,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ResultStatus) Reset() { *m = ResultStatus{} } -func (m *ResultStatus) String() string { return proto.CompactTextString(m) } -func (*ResultStatus) ProtoMessage() {} -func (*ResultStatus) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{0} } - -func (m *ResultStatus) GetNodeInfo() *NodeInfo { - if m != nil { - return m.NodeInfo - } - return nil -} - -func (m *ResultStatus) GetPubKey() *PubKey { - if m != nil { - return m.PubKey - } - return nil -} - -func (m *ResultStatus) GetLatestBlockHash() []byte { - if m != nil { - return m.LatestBlockHash - } - return nil -} - -func (m *ResultStatus) GetLatestBlockHeight() int64 { - if m != nil && m.LatestBlockHeight != nil { - return *m.LatestBlockHeight - } - return 0 -} - -func (m *ResultStatus) GetLatestBlocktime() int64 { - if m != nil && m.LatestBlocktime != nil { - return *m.LatestBlocktime - } - return 0 -} - -type NodeInfo struct { - Id *ID `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - Moniker *string `protobuf:"bytes,2,req,name=moniker" json:"moniker,omitempty"` - Network *string `protobuf:"bytes,3,req,name=network" json:"network,omitempty"` - RemoteAddr *string `protobuf:"bytes,4,req,name=remoteAddr" json:"remoteAddr,omitempty"` - ListenAddr *string `protobuf:"bytes,5,req,name=listenAddr" json:"listenAddr,omitempty"` - Version *string `protobuf:"bytes,6,req,name=version" json:"version,omitempty"` - Other []string `protobuf:"bytes,7,rep,name=other" json:"other,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *NodeInfo) Reset() { *m = NodeInfo{} } -func (m *NodeInfo) String() string { return proto.CompactTextString(m) } -func (*NodeInfo) ProtoMessage() {} -func (*NodeInfo) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{1} } - -func (m *NodeInfo) GetId() *ID { - if m != nil { - return m.Id - } - return nil -} - -func (m *NodeInfo) GetMoniker() string { - if m != nil && m.Moniker != nil { - return *m.Moniker - } - return "" -} - -func (m *NodeInfo) GetNetwork() string { - if m != nil && m.Network != nil { - return *m.Network - } - return "" -} - -func (m *NodeInfo) GetRemoteAddr() string { - if m != nil && m.RemoteAddr != nil { - return *m.RemoteAddr - } - return "" -} - -func (m *NodeInfo) GetListenAddr() string { - if m != nil && m.ListenAddr != nil { - return *m.ListenAddr - } - return "" -} - -func (m *NodeInfo) GetVersion() string { - if m != nil && m.Version != nil { - return *m.Version - } - return "" -} - -func (m *NodeInfo) GetOther() []string { - if m != nil { - return m.Other - } - return nil -} - -type ID struct { - Id *string `protobuf:"bytes,1,req,name=id" json:"id,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *ID) Reset() { *m = ID{} } -func (m *ID) String() string { return proto.CompactTextString(m) } -func (*ID) ProtoMessage() {} -func (*ID) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{2} } - -func (m *ID) GetId() string { - if m != nil && m.Id != nil { - return *m.Id - } - return "" -} - -type PubKey struct { - Ed25519 *PubKeyEd25519 `protobuf:"bytes,1,opt,name=ed25519" json:"ed25519,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PubKey) Reset() { *m = PubKey{} } -func (m *PubKey) String() string { return proto.CompactTextString(m) } -func (*PubKey) ProtoMessage() {} -func (*PubKey) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{3} } - -func (m *PubKey) GetEd25519() *PubKeyEd25519 { - if m != nil { - return m.Ed25519 - } - return nil -} - -type PubKeyEd25519 struct { - Bytes []byte `protobuf:"bytes,1,req,name=bytes" json:"bytes,omitempty"` - XXX_unrecognized []byte `json:"-"` -} - -func (m *PubKeyEd25519) Reset() { *m = PubKeyEd25519{} } -func (m *PubKeyEd25519) String() string { return proto.CompactTextString(m) } -func (*PubKeyEd25519) ProtoMessage() {} -func (*PubKeyEd25519) Descriptor() ([]byte, []int) { return fileDescriptorTest, []int{4} } - -func (m *PubKeyEd25519) GetBytes() []byte { - if m != nil { - return m.Bytes - } - return nil -} - -func init() { - proto.RegisterType((*ResultStatus)(nil), "ResultStatus") - proto.RegisterType((*NodeInfo)(nil), "NodeInfo") - proto.RegisterType((*ID)(nil), "ID") - proto.RegisterType((*PubKey)(nil), "PubKey") - proto.RegisterType((*PubKeyEd25519)(nil), "PubKeyEd25519") -} -func (m *ResultStatus) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ResultStatus) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.NodeInfo != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(m.NodeInfo.Size())) - n1, err := m.NodeInfo.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.PubKey == nil { - return 0, proto.NewRequiredNotSetError("pubKey") - } else { - dAtA[i] = 0x12 - i++ - i = encodeVarintTest(dAtA, i, uint64(m.PubKey.Size())) - n2, err := m.PubKey.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if m.LatestBlockHash == nil { - return 0, proto.NewRequiredNotSetError("latestBlockHash") - } else { - dAtA[i] = 0x1a - i++ - i = encodeVarintTest(dAtA, i, uint64(len(m.LatestBlockHash))) - i += copy(dAtA[i:], m.LatestBlockHash) - } - if m.LatestBlockHeight == nil { - return 0, proto.NewRequiredNotSetError("latestBlockHeight") - } else { - dAtA[i] = 0x20 - i++ - i = encodeVarintTest(dAtA, i, uint64(*m.LatestBlockHeight)) - } - if m.LatestBlocktime == nil { - return 0, proto.NewRequiredNotSetError("latestBlocktime") - } else { - dAtA[i] = 0x28 - i++ - i = encodeVarintTest(dAtA, i, uint64(*m.LatestBlocktime)) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *NodeInfo) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id == nil { - return 0, proto.NewRequiredNotSetError("id") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(m.Id.Size())) - n3, err := m.Id.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n3 - } - if m.Moniker == nil { - return 0, proto.NewRequiredNotSetError("moniker") - } else { - dAtA[i] = 0x12 - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Moniker))) - i += copy(dAtA[i:], *m.Moniker) - } - if m.Network == nil { - return 0, proto.NewRequiredNotSetError("network") - } else { - dAtA[i] = 0x1a - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Network))) - i += copy(dAtA[i:], *m.Network) - } - if m.RemoteAddr == nil { - return 0, proto.NewRequiredNotSetError("remoteAddr") - } else { - dAtA[i] = 0x22 - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.RemoteAddr))) - i += copy(dAtA[i:], *m.RemoteAddr) - } - if m.ListenAddr == nil { - return 0, proto.NewRequiredNotSetError("listenAddr") - } else { - dAtA[i] = 0x2a - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.ListenAddr))) - i += copy(dAtA[i:], *m.ListenAddr) - } - if m.Version == nil { - return 0, proto.NewRequiredNotSetError("version") - } else { - dAtA[i] = 0x32 - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Version))) - i += copy(dAtA[i:], *m.Version) - } - if len(m.Other) > 0 { - for _, s := range m.Other { - dAtA[i] = 0x3a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *ID) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *ID) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Id == nil { - return 0, proto.NewRequiredNotSetError("id") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(len(*m.Id))) - i += copy(dAtA[i:], *m.Id) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PubKey) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PubKey) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Ed25519 != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(m.Ed25519.Size())) - n4, err := m.Ed25519.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n4 - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func (m *PubKeyEd25519) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *PubKeyEd25519) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Bytes == nil { - return 0, proto.NewRequiredNotSetError("bytes") - } else { - dAtA[i] = 0xa - i++ - i = encodeVarintTest(dAtA, i, uint64(len(m.Bytes))) - i += copy(dAtA[i:], m.Bytes) - } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil -} - -func encodeVarintTest(dAtA []byte, offset int, v uint64) int { - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return offset + 1 -} -func (m *ResultStatus) Size() (n int) { - var l int - _ = l - if m.NodeInfo != nil { - l = m.NodeInfo.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.PubKey != nil { - l = m.PubKey.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.LatestBlockHash != nil { - l = len(m.LatestBlockHash) - n += 1 + l + sovTest(uint64(l)) - } - if m.LatestBlockHeight != nil { - n += 1 + sovTest(uint64(*m.LatestBlockHeight)) - } - if m.LatestBlocktime != nil { - n += 1 + sovTest(uint64(*m.LatestBlocktime)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *NodeInfo) Size() (n int) { - var l int - _ = l - if m.Id != nil { - l = m.Id.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.Moniker != nil { - l = len(*m.Moniker) - n += 1 + l + sovTest(uint64(l)) - } - if m.Network != nil { - l = len(*m.Network) - n += 1 + l + sovTest(uint64(l)) - } - if m.RemoteAddr != nil { - l = len(*m.RemoteAddr) - n += 1 + l + sovTest(uint64(l)) - } - if m.ListenAddr != nil { - l = len(*m.ListenAddr) - n += 1 + l + sovTest(uint64(l)) - } - if m.Version != nil { - l = len(*m.Version) - n += 1 + l + sovTest(uint64(l)) - } - if len(m.Other) > 0 { - for _, s := range m.Other { - l = len(s) - n += 1 + l + sovTest(uint64(l)) - } - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *ID) Size() (n int) { - var l int - _ = l - if m.Id != nil { - l = len(*m.Id) - n += 1 + l + sovTest(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PubKey) Size() (n int) { - var l int - _ = l - if m.Ed25519 != nil { - l = m.Ed25519.Size() - n += 1 + l + sovTest(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func (m *PubKeyEd25519) Size() (n int) { - var l int - _ = l - if m.Bytes != nil { - l = len(m.Bytes) - n += 1 + l + sovTest(uint64(l)) - } - if m.XXX_unrecognized != nil { - n += len(m.XXX_unrecognized) - } - return n -} - -func sovTest(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} - -func (m *ResultStatus) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ResultStatus: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ResultStatus: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NodeInfo", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NodeInfo == nil { - m.NodeInfo = &NodeInfo{} - } - if err := m.NodeInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PubKey", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.PubKey == nil { - m.PubKey = &PubKey{} - } - if err := m.PubKey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestBlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LatestBlockHash = append(m.LatestBlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.LatestBlockHash == nil { - m.LatestBlockHash = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestBlockHeight", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.LatestBlockHeight = &v - hasFields[0] |= uint64(0x00000004) - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LatestBlocktime", wireType) - } - var v int64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.LatestBlocktime = &v - hasFields[0] |= uint64(0x00000008) - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("pubKey") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return proto.NewRequiredNotSetError("latestBlockHash") - } - if hasFields[0]&uint64(0x00000004) == 0 { - return proto.NewRequiredNotSetError("latestBlockHeight") - } - if hasFields[0]&uint64(0x00000008) == 0 { - return proto.NewRequiredNotSetError("latestBlocktime") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NodeInfo) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: NodeInfo: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeInfo: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Id == nil { - m.Id = &ID{} - } - if err := m.Id.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Moniker", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Moniker = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000002) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Network", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Network = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000004) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RemoteAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.RemoteAddr = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000008) - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ListenAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.ListenAddr = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000010) - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Version = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000020) - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Other", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Other = append(m.Other, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("id") - } - if hasFields[0]&uint64(0x00000002) == 0 { - return proto.NewRequiredNotSetError("moniker") - } - if hasFields[0]&uint64(0x00000004) == 0 { - return proto.NewRequiredNotSetError("network") - } - if hasFields[0]&uint64(0x00000008) == 0 { - return proto.NewRequiredNotSetError("remoteAddr") - } - if hasFields[0]&uint64(0x00000010) == 0 { - return proto.NewRequiredNotSetError("listenAddr") - } - if hasFields[0]&uint64(0x00000020) == 0 { - return proto.NewRequiredNotSetError("version") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ID) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - s := string(dAtA[iNdEx:postIndex]) - m.Id = &s - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("id") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PubKey) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PubKey: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKey: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Ed25519 == nil { - m.Ed25519 = &PubKeyEd25519{} - } - if err := m.Ed25519.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PubKeyEd25519) Unmarshal(dAtA []byte) error { - var hasFields [1]uint64 - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: PubKeyEd25519: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKeyEd25519: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Bytes", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTest - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTest - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Bytes = append(m.Bytes[:0], dAtA[iNdEx:postIndex]...) - if m.Bytes == nil { - m.Bytes = []byte{} - } - iNdEx = postIndex - hasFields[0] |= uint64(0x00000001) - default: - iNdEx = preIndex - skippy, err := skipTest(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTest - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - m.XXX_unrecognized = append(m.XXX_unrecognized, dAtA[iNdEx:iNdEx+skippy]...) - iNdEx += skippy - } - } - if hasFields[0]&uint64(0x00000001) == 0 { - return proto.NewRequiredNotSetError("bytes") - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTest(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - return iNdEx, nil - case 1: - iNdEx += 8 - return iNdEx, nil - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - iNdEx += length - if length < 0 { - return 0, ErrInvalidLengthTest - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTest - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - innerWire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - innerWireType := int(innerWire & 0x7) - if innerWireType == 4 { - break - } - next, err := skipTest(dAtA[start:]) - if err != nil { - return 0, err - } - iNdEx = start + next - } - return iNdEx, nil - case 4: - return iNdEx, nil - case 5: - iNdEx += 4 - return iNdEx, nil - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - } - panic("unreachable") -} - -var ( - ErrInvalidLengthTest = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTest = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("test.proto", fileDescriptorTest) } - -var fileDescriptorTest = []byte{ - // 342 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x64, 0x91, 0x41, 0x4b, 0xf3, 0x30, - 0x1c, 0xc6, 0x49, 0xfb, 0x6e, 0x5d, 0xff, 0xeb, 0x3b, 0x31, 0xee, 0x90, 0x53, 0x2d, 0x85, 0x41, - 0x0f, 0x52, 0xb0, 0xb0, 0x83, 0x47, 0xc7, 0x04, 0x87, 0x20, 0x23, 0x7e, 0x82, 0xcd, 0xfe, 0x75, - 0x65, 0x5d, 0x33, 0x92, 0x4c, 0xd9, 0xe7, 0xf3, 0xe2, 0xd1, 0xa3, 0x47, 0xd9, 0x27, 0x91, 0xa6, - 0xed, 0x9c, 0xf3, 0xf8, 0xfc, 0x7e, 0xe5, 0xc9, 0xd3, 0x04, 0x40, 0xa3, 0xd2, 0xf1, 0x5a, 0x0a, - 0x2d, 0xc2, 0x4f, 0x02, 0x1e, 0x47, 0xb5, 0xc9, 0xf5, 0x83, 0x9e, 0xe9, 0x8d, 0xa2, 0x03, 0xe8, - 0x14, 0x22, 0xc5, 0x49, 0xf1, 0x24, 0x18, 0x09, 0x48, 0xd4, 0x4d, 0xdc, 0xf8, 0xbe, 0x06, 0x7c, - 0xaf, 0xe8, 0x39, 0xb4, 0xd7, 0x9b, 0xf9, 0x1d, 0x6e, 0x99, 0x15, 0x58, 0x51, 0x37, 0x71, 0xe2, - 0xa9, 0x89, 0xbc, 0xc6, 0x34, 0x82, 0x93, 0x7c, 0x56, 0x1e, 0x34, 0xca, 0xc5, 0xe3, 0xf2, 0x76, - 0xa6, 0x16, 0xcc, 0x0e, 0xac, 0xc8, 0xe3, 0xc7, 0x98, 0x5e, 0xc0, 0xe9, 0x21, 0xc2, 0xec, 0x79, - 0xa1, 0xd9, 0xbf, 0xc0, 0x8a, 0x6c, 0xfe, 0x57, 0x1c, 0xf5, 0xea, 0x6c, 0x85, 0xac, 0x65, 0xbe, - 0x3d, 0xc6, 0xe1, 0x1b, 0x81, 0x4e, 0xb3, 0x9c, 0x9e, 0x81, 0x95, 0xa5, 0x8c, 0x98, 0xad, 0x76, - 0x3c, 0x19, 0x73, 0x2b, 0x4b, 0x29, 0x03, 0x67, 0x25, 0x8a, 0x6c, 0x89, 0xd2, 0xfc, 0x85, 0xcb, - 0x9b, 0x58, 0x9a, 0x02, 0xf5, 0xab, 0x90, 0x4b, 0xb3, 0xda, 0xe5, 0x4d, 0xa4, 0x3e, 0x80, 0xc4, - 0x95, 0xd0, 0x78, 0x9d, 0xa6, 0xd2, 0xcc, 0x74, 0xf9, 0x01, 0x29, 0x7d, 0x9e, 0x29, 0x8d, 0x85, - 0xf1, 0xad, 0xca, 0xff, 0x90, 0xb2, 0xf9, 0x05, 0xa5, 0xca, 0x44, 0xc1, 0xda, 0x55, 0x73, 0x1d, - 0x69, 0x1f, 0x5a, 0x42, 0x2f, 0x50, 0x32, 0x27, 0xb0, 0x23, 0x97, 0x57, 0x21, 0xec, 0x83, 0x35, - 0x19, 0xd3, 0xde, 0x7e, 0xbe, 0x5b, 0x2e, 0x0f, 0x13, 0x68, 0x4f, 0x9b, 0x7b, 0x76, 0x30, 0x4d, - 0x86, 0xc3, 0xcb, 0xab, 0xfa, 0xb9, 0x7a, 0xf5, 0x4b, 0xdc, 0x54, 0x94, 0x37, 0x3a, 0x1c, 0xc0, - 0xff, 0x5f, 0xa6, 0x3c, 0x70, 0xbe, 0xd5, 0xa8, 0x4c, 0xaf, 0xc7, 0xab, 0x30, 0xf2, 0xde, 0x77, - 0x3e, 0xf9, 0xd8, 0xf9, 0xe4, 0x6b, 0xe7, 0x93, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb1, 0xee, - 0x6b, 0xdd, 0x2c, 0x02, 0x00, 0x00, -} diff --git a/benchmarks/proto/test.proto b/benchmarks/proto/test.proto deleted file mode 100644 index 6d770d98a..000000000 --- a/benchmarks/proto/test.proto +++ /dev/null @@ -1,29 +0,0 @@ -message ResultStatus { - optional NodeInfo nodeInfo = 1; - required PubKey pubKey = 2; - required bytes latestBlockHash = 3; - required int64 latestBlockHeight = 4; - required int64 latestBlocktime = 5; -} - -message NodeInfo { - required ID id = 1; - required string moniker = 2; - required string network = 3; - required string remoteAddr = 4; - required string listenAddr = 5; - required string version = 6; - repeated string other = 7; -} - -message ID { - required string id = 1; -} - -message PubKey { - optional PubKeyEd25519 ed25519 = 1; -} - -message PubKeyEd25519 { - required bytes bytes = 1; -} diff --git a/benchmarks/simu/counter.go b/benchmarks/simu/counter.go deleted file mode 100644 index c24eddf8a..000000000 --- a/benchmarks/simu/counter.go +++ /dev/null @@ -1,47 +0,0 @@ -package main - -import ( - "context" - "encoding/binary" - "fmt" - "time" - - cmn "github.com/tendermint/tendermint/libs/common" - rpcclient "github.com/tendermint/tendermint/rpc/lib/client" -) - -func main() { - wsc := rpcclient.NewWSClient("127.0.0.1:26657", "/websocket") - err := wsc.Start() - if err != nil { - cmn.Exit(err.Error()) - } - defer wsc.Stop() - - // Read a bunch of responses - go func() { - for { - _, ok := <-wsc.ResponsesCh - if !ok { - break - } - //fmt.Println("Received response", string(wire.JSONBytes(res))) - } - }() - - // Make a bunch of requests - buf := make([]byte, 32) - for i := 0; ; i++ { - binary.BigEndian.PutUint64(buf, uint64(i)) - //txBytes := hex.EncodeToString(buf[:n]) - fmt.Print(".") - err = wsc.Call(context.TODO(), "broadcast_tx", map[string]interface{}{"tx": buf[:8]}) - if err != nil { - cmn.Exit(err.Error()) - } - if i%1000 == 0 { - fmt.Println(i) - } - time.Sleep(time.Microsecond * 1000) - } -} diff --git a/blockchain/v0/pool.go b/blockchain/v0/pool.go index 7733dc5ff..a1901842e 100644 --- a/blockchain/v0/pool.go +++ b/blockchain/v0/pool.go @@ -247,7 +247,14 @@ func (pool *BlockPool) AddBlock(peerID p2p.ID, block *types.Block, blockSize int requester := pool.requesters[block.Height] if requester == nil { - pool.Logger.Info("peer sent us a block we didn't expect", "peer", peerID, "curHeight", pool.height, "blockHeight", block.Height) + pool.Logger.Info( + "peer sent us a block we didn't expect", + "peer", + peerID, + "curHeight", + pool.height, + "blockHeight", + block.Height) diff := pool.height - block.Height if diff < 0 { diff *= -1 @@ -422,14 +429,14 @@ func (pool *BlockPool) debug() string { //------------------------------------- type bpPeer struct { + didTimeout bool + numPending int32 + height int64 pool *BlockPool id p2p.ID recvMonitor *flow.Monitor - height int64 - numPending int32 - timeout *time.Timer - didTimeout bool + timeout *time.Timer logger log.Logger } diff --git a/blockchain/v0/pool_test.go b/blockchain/v0/pool_test.go index d741d59df..a573b27b2 100644 --- a/blockchain/v0/pool_test.go +++ b/blockchain/v0/pool_test.go @@ -42,7 +42,8 @@ func (p testPeer) runInputRoutine() { func (p testPeer) simulateInput(input inputData) { block := &types.Block{Header: types.Header{Height: input.request.Height}} input.pool.AddBlock(input.request.PeerID, block, 123) - // TODO: uncommenting this creates a race which is detected by: https://github.com/golang/go/blob/2bd767b1022dd3254bcec469f0ee164024726486/src/testing/testing.go#L854-L856 + // TODO: uncommenting this creates a race which is detected by: + // https://github.com/golang/go/blob/2bd767b1022dd3254bcec469f0ee164024726486/src/testing/testing.go#L854-L856 // see: https://github.com/tendermint/tendermint/issues/3390#issue-418379890 // input.t.Logf("Added block from peer %v (height: %v)", input.request.PeerID, input.request.Height) } diff --git a/blockchain/v0/reactor_test.go b/blockchain/v0/reactor_test.go index 0a88dbd74..6c4c8333d 100644 --- a/blockchain/v0/reactor_test.go +++ b/blockchain/v0/reactor_test.go @@ -50,7 +50,11 @@ type BlockchainReactorPair struct { app proxy.AppConns } -func newBlockchainReactor(logger log.Logger, genDoc *types.GenesisDoc, privVals []types.PrivValidator, maxBlockHeight int64) BlockchainReactorPair { +func newBlockchainReactor( + logger log.Logger, + genDoc *types.GenesisDoc, + privVals []types.PrivValidator, + maxBlockHeight int64) BlockchainReactorPair { if len(privVals) != 1 { panic("only support one validator") } @@ -88,7 +92,12 @@ func newBlockchainReactor(logger log.Logger, genDoc *types.GenesisDoc, privVals lastBlockMeta := blockStore.LoadBlockMeta(blockHeight - 1) lastBlock := blockStore.LoadBlock(blockHeight - 1) - vote, err := types.MakeVote(lastBlock.Header.Height, lastBlockMeta.BlockID, state.Validators, privVals[0], lastBlock.Header.ChainID) + vote, err := types.MakeVote( + lastBlock.Header.Height, + lastBlockMeta.BlockID, + state.Validators, + privVals[0], + lastBlock.Header.ChainID) if err != nil { panic(err) } diff --git a/blockchain/v1/pool_test.go b/blockchain/v1/pool_test.go index 5530ecd41..e612eb43e 100644 --- a/blockchain/v1/pool_test.go +++ b/blockchain/v1/pool_test.go @@ -198,14 +198,22 @@ func TestBlockPoolRemovePeer(t *testing.T) { poolWanted: makeBlockPool(testBcR, 100, []BpPeer{}, map[int64]tPBlocks{}), }, { - name: "delete the shortest of two peers without blocks", - pool: makeBlockPool(testBcR, 100, []BpPeer{{ID: "P1", Height: 100}, {ID: "P2", Height: 120}}, map[int64]tPBlocks{}), + name: "delete the shortest of two peers without blocks", + pool: makeBlockPool( + testBcR, + 100, + []BpPeer{{ID: "P1", Height: 100}, {ID: "P2", Height: 120}}, + map[int64]tPBlocks{}), args: args{"P1", nil}, poolWanted: makeBlockPool(testBcR, 100, []BpPeer{{ID: "P2", Height: 120}}, map[int64]tPBlocks{}), }, { - name: "delete the tallest of two peers without blocks", - pool: makeBlockPool(testBcR, 100, []BpPeer{{ID: "P1", Height: 100}, {ID: "P2", Height: 120}}, map[int64]tPBlocks{}), + name: "delete the tallest of two peers without blocks", + pool: makeBlockPool( + testBcR, + 100, + []BpPeer{{ID: "P1", Height: 100}, {ID: "P2", Height: 120}}, + map[int64]tPBlocks{}), args: args{"P2", nil}, poolWanted: makeBlockPool(testBcR, 100, []BpPeer{{ID: "P1", Height: 100}}, map[int64]tPBlocks{}), }, @@ -308,8 +316,12 @@ func TestBlockPoolSendRequestBatch(t *testing.T) { expnumPendingBlockRequests: 2, }, { - name: "n peers - send n*maxRequestsPerPeer block requests", - pool: makeBlockPool(testBcR, 10, []BpPeer{{ID: "P1", Height: 100}, {ID: "P2", Height: 100}}, map[int64]tPBlocks{}), + name: "n peers - send n*maxRequestsPerPeer block requests", + pool: makeBlockPool( + testBcR, + 10, + []BpPeer{{ID: "P1", Height: 100}, {ID: "P2", Height: 100}}, + map[int64]tPBlocks{}), maxRequestsPerPeer: 2, expRequests: map[int64]bool{10: true, 11: true}, expPeerResults: []testPeerResult{ diff --git a/blockchain/v1/reactor_fsm.go b/blockchain/v1/reactor_fsm.go index 4bfef64ea..8d3a363ae 100644 --- a/blockchain/v1/reactor_fsm.go +++ b/blockchain/v1/reactor_fsm.go @@ -162,10 +162,12 @@ var ( errNoTallerPeer = errors.New("fast sync timed out on waiting for a peer taller than this node") // reported eventually to the switch - errPeerLowersItsHeight = errors.New("fast sync peer reports a height lower than previous") // handle return - errNoPeerResponseForCurrentHeights = errors.New("fast sync timed out on peer block response for current heights") // handle return - errNoPeerResponse = errors.New("fast sync timed out on peer block response") // xx - errBadDataFromPeer = errors.New("fast sync received block from wrong peer or block is bad") // xx + // handle return + errPeerLowersItsHeight = errors.New("fast sync peer reports a height lower than previous") + // handle return + errNoPeerResponseForCurrentHeights = errors.New("fast sync timed out on peer block response for current heights") + errNoPeerResponse = errors.New("fast sync timed out on peer block response") // xx + errBadDataFromPeer = errors.New("fast sync received block from wrong peer or block is bad") // xx errDuplicateBlock = errors.New("fast sync received duplicate block from peer") errBlockVerificationFailure = errors.New("fast sync block verification failure") // xx errSlowPeer = errors.New("fast sync peer is not sending us data fast enough") // xx diff --git a/blockchain/v1/reactor_test.go b/blockchain/v1/reactor_test.go index 00f7b0968..d9cc99af6 100644 --- a/blockchain/v1/reactor_test.go +++ b/blockchain/v1/reactor_test.go @@ -45,7 +45,11 @@ func randGenesisDoc(numValidators int, randPower bool, minPower int64) (*types.G }, privValidators } -func makeVote(header *types.Header, blockID types.BlockID, valset *types.ValidatorSet, privVal types.PrivValidator) *types.Vote { +func makeVote( + header *types.Header, + blockID types.BlockID, + valset *types.ValidatorSet, + privVal types.PrivValidator) *types.Vote { addr := privVal.GetPubKey().Address() idx, _ := valset.GetByAddress(addr) vote := &types.Vote{ @@ -68,7 +72,11 @@ type BlockchainReactorPair struct { conR *consensusReactorTest } -func newBlockchainReactor(logger log.Logger, genDoc *types.GenesisDoc, privVals []types.PrivValidator, maxBlockHeight int64) *BlockchainReactor { +func newBlockchainReactor( + logger log.Logger, + genDoc *types.GenesisDoc, + privVals []types.PrivValidator, + maxBlockHeight int64) *BlockchainReactor { if len(privVals) != 1 { panic("only support one validator") } @@ -129,7 +137,11 @@ func newBlockchainReactor(logger log.Logger, genDoc *types.GenesisDoc, privVals return bcReactor } -func newBlockchainReactorPair(logger log.Logger, genDoc *types.GenesisDoc, privVals []types.PrivValidator, maxBlockHeight int64) BlockchainReactorPair { +func newBlockchainReactorPair( + logger log.Logger, + genDoc *types.GenesisDoc, + privVals []types.PrivValidator, + maxBlockHeight int64) BlockchainReactorPair { consensusReactor := &consensusReactorTest{} consensusReactor.BaseReactor = *p2p.NewBaseReactor("Consensus reactor", consensusReactor) diff --git a/blockchain/v2/metrics.go b/blockchain/v2/metrics.go new file mode 100644 index 000000000..d865e7360 --- /dev/null +++ b/blockchain/v2/metrics.go @@ -0,0 +1,124 @@ +package v2 + +import ( + "github.com/go-kit/kit/metrics" + "github.com/go-kit/kit/metrics/discard" + "github.com/go-kit/kit/metrics/prometheus" + stdprometheus "github.com/prometheus/client_golang/prometheus" +) + +const ( + // MetricsSubsystem is a subsystem shared by all metrics exposed by this + // package. + MetricsSubsystem = "blockchain" +) + +// Metrics contains metrics exposed by this package. +type Metrics struct { + // events_in + EventsIn metrics.Counter + // events_in + EventsHandled metrics.Counter + // events_out + EventsOut metrics.Counter + // errors_in + ErrorsIn metrics.Counter + // errors_handled + ErrorsHandled metrics.Counter + // errors_out + ErrorsOut metrics.Counter + // events_shed + EventsShed metrics.Counter + // events_sent + EventsSent metrics.Counter + // errors_sent + ErrorsSent metrics.Counter + // errors_shed + ErrorsShed metrics.Counter +} + +// Can we burn in the routine name here? +func PrometheusMetrics(namespace string, labelsAndValues ...string) *Metrics { + labels := []string{} + for i := 0; i < len(labelsAndValues); i += 2 { + labels = append(labels, labelsAndValues[i]) + } + return &Metrics{ + EventsIn: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_in", + Help: "Events read from the channel.", + }, labels).With(labelsAndValues...), + EventsHandled: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_handled", + Help: "Events handled", + }, labels).With(labelsAndValues...), + EventsOut: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_out", + Help: "Events output from routine.", + }, labels).With(labelsAndValues...), + ErrorsIn: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_in", + Help: "Errors read from the channel.", + }, labels).With(labelsAndValues...), + ErrorsHandled: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_handled", + Help: "Errors handled.", + }, labels).With(labelsAndValues...), + ErrorsOut: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_out", + Help: "Errors output from routine.", + }, labels).With(labelsAndValues...), + ErrorsSent: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_sent", + Help: "Errors sent to routine.", + }, labels).With(labelsAndValues...), + ErrorsShed: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "errors_shed", + Help: "Errors dropped from sending.", + }, labels).With(labelsAndValues...), + EventsSent: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_sent", + Help: "Events sent to routine.", + }, labels).With(labelsAndValues...), + EventsShed: prometheus.NewCounterFrom(stdprometheus.CounterOpts{ + Namespace: namespace, + Subsystem: MetricsSubsystem, + Name: "events_shed", + Help: "Events dropped from sending.", + }, labels).With(labelsAndValues...), + } +} + +// NopMetrics returns no-op Metrics. +func NopMetrics() *Metrics { + return &Metrics{ + EventsIn: discard.NewCounter(), + EventsHandled: discard.NewCounter(), + EventsOut: discard.NewCounter(), + ErrorsIn: discard.NewCounter(), + ErrorsHandled: discard.NewCounter(), + ErrorsOut: discard.NewCounter(), + EventsShed: discard.NewCounter(), + EventsSent: discard.NewCounter(), + ErrorsSent: discard.NewCounter(), + ErrorsShed: discard.NewCounter(), + } +} diff --git a/blockchain/v2/processor.go b/blockchain/v2/processor.go new file mode 100644 index 000000000..22b46ede3 --- /dev/null +++ b/blockchain/v2/processor.go @@ -0,0 +1,186 @@ +package v2 + +import ( + "fmt" + + "github.com/tendermint/tendermint/p2p" + tdState "github.com/tendermint/tendermint/state" + "github.com/tendermint/tendermint/types" +) + +type peerError struct { + priorityHigh + peerID p2p.ID +} + +type pcDuplicateBlock struct { + priorityNormal +} + +type pcShortBlock struct { + priorityNormal +} + +type bcBlockResponse struct { + priorityNormal + peerID p2p.ID + block *types.Block + height int64 +} + +type pcBlockVerificationFailure struct { + priorityNormal + peerID p2p.ID + height int64 +} + +type pcBlockProcessed struct { + priorityNormal + height int64 + peerID p2p.ID +} + +type pcProcessBlock struct { + priorityNormal +} + +type pcStop struct { + priorityNormal +} + +type pcFinished struct { + priorityNormal + height int64 + blocksSynced int64 +} + +func (p pcFinished) Error() string { + return "finished" +} + +type queueItem struct { + block *types.Block + peerID p2p.ID +} + +type blockQueue map[int64]queueItem + +type pcState struct { + height int64 // height of the last synced block + queue blockQueue // blocks waiting to be processed + chainID string + blocksSynced int64 + draining bool + tdState tdState.State + context processorContext +} + +func (state *pcState) String() string { + return fmt.Sprintf("height: %d queue length: %d draining: %v blocks synced: %d", + state.height, len(state.queue), state.draining, state.blocksSynced) +} + +// newPcState returns a pcState initialized with the last verified block enqueued +func newPcState(initHeight int64, tdState tdState.State, chainID string, context processorContext) *pcState { + return &pcState{ + height: initHeight, + queue: blockQueue{}, + chainID: chainID, + draining: false, + blocksSynced: 0, + context: context, + tdState: tdState, + } +} + +// nextTwo returns the next two unverified blocks +func (state *pcState) nextTwo() (queueItem, queueItem, error) { + if first, ok := state.queue[state.height+1]; ok { + if second, ok := state.queue[state.height+2]; ok { + return first, second, nil + } + } + return queueItem{}, queueItem{}, fmt.Errorf("not found") +} + +// synced returns true when at most the last verified block remains in the queue +func (state *pcState) synced() bool { + return len(state.queue) <= 1 +} + +func (state *pcState) advance() { + state.height++ + delete(state.queue, state.height) + state.blocksSynced++ +} + +func (state *pcState) enqueue(peerID p2p.ID, block *types.Block, height int64) error { + if _, ok := state.queue[height]; ok { + return fmt.Errorf("duplicate queue item") + } + state.queue[height] = queueItem{block: block, peerID: peerID} + return nil +} + +// purgePeer moves all unprocessed blocks from the queue +func (state *pcState) purgePeer(peerID p2p.ID) { + // what if height is less than state.height? + for height, item := range state.queue { + if item.peerID == peerID { + delete(state.queue, height) + } + } +} + +// handle processes FSM events +func (state *pcState) handle(event Event) (Event, error) { + switch event := event.(type) { + case *bcBlockResponse: + if event.height <= state.height { + return pcShortBlock{}, nil + } + err := state.enqueue(event.peerID, event.block, event.height) + if err != nil { + return pcDuplicateBlock{}, nil + } + + case pcProcessBlock: + firstItem, secondItem, err := state.nextTwo() + if err != nil { + if state.draining { + return noOp, pcFinished{height: state.height} + } + return noOp, nil + } + first, second := firstItem.block, secondItem.block + + firstParts := first.MakePartSet(types.BlockPartSizeBytes) + firstPartsHeader := firstParts.Header() + firstID := types.BlockID{Hash: first.Hash(), PartsHeader: firstPartsHeader} + + err = state.context.verifyCommit(state.chainID, firstID, first.Height, second.LastCommit) + if err != nil { + return pcBlockVerificationFailure{peerID: firstItem.peerID, height: first.Height}, nil + } + + state.context.saveBlock(first, firstParts, second.LastCommit) + + state.tdState, err = state.context.applyBlock(state.tdState, firstID, first) + if err != nil { + panic(fmt.Sprintf("failed to process committed block (%d:%X): %v", first.Height, first.Hash(), err)) + } + state.advance() + return pcBlockProcessed{height: first.Height, peerID: firstItem.peerID}, nil + + case *peerError: + state.purgePeer(event.peerID) + + case pcStop: + if state.synced() { + return noOp, pcFinished{height: state.height, blocksSynced: state.blocksSynced} + } + state.draining = true + } + + return noOp, nil +} diff --git a/blockchain/v2/processor_context.go b/blockchain/v2/processor_context.go new file mode 100644 index 000000000..c4c8770cd --- /dev/null +++ b/blockchain/v2/processor_context.go @@ -0,0 +1,76 @@ +package v2 + +import ( + "fmt" + + "github.com/tendermint/tendermint/state" + "github.com/tendermint/tendermint/store" + "github.com/tendermint/tendermint/types" +) + +type processorContext interface { + applyBlock(state state.State, blockID types.BlockID, block *types.Block) (state.State, error) + verifyCommit(chainID string, blockID types.BlockID, height int64, commit *types.Commit) error + saveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) +} + +// nolint:unused +type pContext struct { + store *store.BlockStore + executor *state.BlockExecutor + state *state.State +} + +// nolint:unused,deadcode +func newProcessorContext(st *store.BlockStore, ex *state.BlockExecutor, s *state.State) *pContext { + return &pContext{ + store: st, + executor: ex, + state: s, + } +} + +func (pc *pContext) applyBlock(state state.State, blockID types.BlockID, block *types.Block) (state.State, error) { + return pc.executor.ApplyBlock(state, blockID, block) +} + +func (pc *pContext) verifyCommit(chainID string, blockID types.BlockID, height int64, commit *types.Commit) error { + return pc.state.Validators.VerifyCommit(chainID, blockID, height, commit) +} + +func (pc *pContext) saveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) { + pc.store.SaveBlock(block, blockParts, seenCommit) +} + +type mockPContext struct { + applicationBL []int64 + verificationBL []int64 +} + +func newMockProcessorContext(verificationBlackList []int64, applicationBlackList []int64) *mockPContext { + return &mockPContext{ + applicationBL: applicationBlackList, + verificationBL: verificationBlackList, + } +} + +func (mpc *mockPContext) applyBlock(state state.State, blockID types.BlockID, block *types.Block) (state.State, error) { + for _, h := range mpc.applicationBL { + if h == block.Height { + return state, fmt.Errorf("generic application error") + } + } + return state, nil +} + +func (mpc *mockPContext) verifyCommit(chainID string, blockID types.BlockID, height int64, commit *types.Commit) error { + for _, h := range mpc.verificationBL { + if h == height { + return fmt.Errorf("generic verification error") + } + } + return nil +} + +func (mpc *mockPContext) saveBlock(block *types.Block, blockParts *types.PartSet, seenCommit *types.Commit) { +} diff --git a/blockchain/v2/processor_test.go b/blockchain/v2/processor_test.go new file mode 100644 index 000000000..195df3618 --- /dev/null +++ b/blockchain/v2/processor_test.go @@ -0,0 +1,336 @@ +package v2 + +import ( + "testing" + + "github.com/stretchr/testify/assert" + "github.com/tendermint/tendermint/p2p" + tdState "github.com/tendermint/tendermint/state" + "github.com/tendermint/tendermint/types" +) + +// pcBlock is a test helper structure with simple types. Its purpose is to help with test readability. +type pcBlock struct { + pid string + height int64 +} + +// params is a test structure used to create processor state. +type params struct { + height int64 + items []pcBlock + blocksSynced int64 + verBL []int64 + appBL []int64 + draining bool +} + +// makePcBlock makes an empty block. +func makePcBlock(height int64) *types.Block { + return &types.Block{Header: types.Header{Height: height}} +} + +// makeState takes test parameters and creates a specific processor state. +func makeState(p *params) *pcState { + var ( + tdState = tdState.State{} + context = newMockProcessorContext(p.verBL, p.appBL) + ) + state := newPcState(p.height, tdState, "test", context) + + for _, item := range p.items { + _ = state.enqueue(p2p.ID(item.pid), makePcBlock(item.height), item.height) + } + + state.blocksSynced = p.blocksSynced + state.draining = p.draining + return state +} + +func mBlockResponse(peerID p2p.ID, height int64) *bcBlockResponse { + return &bcBlockResponse{ + peerID: peerID, + block: makePcBlock(height), + height: height, + } +} + +type pcFsmMakeStateValues struct { + currentState *params + event Event + wantState *params + wantNextEvent Event + wantErr error + wantPanic bool +} + +type testFields struct { + name string + steps []pcFsmMakeStateValues +} + +func executeProcessorTests(t *testing.T, tests []testFields) { + for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T) { + var state *pcState + for _, step := range tt.steps { + defer func() { + r := recover() + if (r != nil) != step.wantPanic { + t.Errorf("recover = %v, wantPanic = %v", r, step.wantPanic) + } + }() + + // First step must always initialise the currentState as state. + if step.currentState != nil { + state = makeState(step.currentState) + } + if state == nil { + panic("Bad (initial?) step") + } + + nextEvent, err := state.handle(step.event) + t.Log(state) + assert.Equal(t, step.wantErr, err) + assert.Equal(t, makeState(step.wantState), state) + assert.Equal(t, step.wantNextEvent, nextEvent) + // Next step may use the wantedState as their currentState. + state = makeState(step.wantState) + } + }) + } +} + +func TestPcBlockResponse(t *testing.T) { + tests := []testFields{ + + { + name: "add one block", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{}, event: mBlockResponse("P1", 1), + wantState: ¶ms{items: []pcBlock{{"P1", 1}}}, wantNextEvent: noOp, + }, + }, + }, + { + name: "add two blocks", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{}, event: mBlockResponse("P1", 3), + wantState: ¶ms{items: []pcBlock{{"P1", 3}}}, wantNextEvent: noOp, + }, + { // use previous wantState as currentState, + event: mBlockResponse("P1", 4), + wantState: ¶ms{items: []pcBlock{{"P1", 3}, {"P1", 4}}}, wantNextEvent: noOp, + }, + }, + }, + { + name: "add duplicate block from same peer", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{}, event: mBlockResponse("P1", 3), + wantState: ¶ms{items: []pcBlock{{"P1", 3}}}, wantNextEvent: noOp, + }, + { // use previous wantState as currentState, + event: mBlockResponse("P1", 3), + wantState: ¶ms{items: []pcBlock{{"P1", 3}}}, wantNextEvent: pcDuplicateBlock{}, + }, + }, + }, + { + name: "add duplicate block from different peer", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{}, event: mBlockResponse("P1", 3), + wantState: ¶ms{items: []pcBlock{{"P1", 3}}}, wantNextEvent: noOp, + }, + { // use previous wantState as currentState, + event: mBlockResponse("P2", 3), + wantState: ¶ms{items: []pcBlock{{"P1", 3}}}, wantNextEvent: pcDuplicateBlock{}, + }, + }, + }, + { + name: "attempt to add block with height equal to state.height", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{height: 2, items: []pcBlock{{"P1", 3}}}, event: mBlockResponse("P1", 2), + wantState: ¶ms{height: 2, items: []pcBlock{{"P1", 3}}}, wantNextEvent: pcShortBlock{}, + }, + }, + }, + { + name: "attempt to add block with height smaller than state.height", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{height: 2, items: []pcBlock{{"P1", 3}}}, event: mBlockResponse("P1", 1), + wantState: ¶ms{height: 2, items: []pcBlock{{"P1", 3}}}, wantNextEvent: pcShortBlock{}, + }, + }, + }, + } + + executeProcessorTests(t, tests) +} + +func TestPcProcessBlockSuccess(t *testing.T) { + tests := []testFields{ + { + name: "noop - no blocks over current height", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{}, event: pcProcessBlock{}, + wantState: ¶ms{}, wantNextEvent: noOp, + }, + }, + }, + { + name: "noop - high new blocks", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{height: 5, items: []pcBlock{{"P1", 30}, {"P2", 31}}}, event: pcProcessBlock{}, + wantState: ¶ms{height: 5, items: []pcBlock{{"P1", 30}, {"P2", 31}}}, wantNextEvent: noOp, + }, + }, + }, + { + name: "blocks H+1 and H+2 present", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}}, event: pcProcessBlock{}, + wantState: ¶ms{height: 1, items: []pcBlock{{"P2", 2}}, blocksSynced: 1}, + wantNextEvent: pcBlockProcessed{height: 1, peerID: "P1"}, + }, + }, + }, + { + name: "blocks H+1 and H+2 present after draining", + steps: []pcFsmMakeStateValues{ + { // some contiguous blocks - on stop check draining is set + currentState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}, {"P1", 4}}}, event: pcStop{}, + wantState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}, {"P1", 4}}, draining: true}, + wantNextEvent: noOp, + }, + { + event: pcProcessBlock{}, + wantState: ¶ms{height: 1, items: []pcBlock{{"P2", 2}, {"P1", 4}}, blocksSynced: 1, draining: true}, + wantNextEvent: pcBlockProcessed{height: 1, peerID: "P1"}, + }, + { // finish when H+1 or/and H+2 are missing + event: pcProcessBlock{}, + wantState: ¶ms{height: 1, items: []pcBlock{{"P2", 2}, {"P1", 4}}, blocksSynced: 1, draining: true}, + wantNextEvent: noOp, + wantErr: pcFinished{height: 1}, + }, + }, + }, + } + + executeProcessorTests(t, tests) +} + +func TestPcProcessBlockFailures(t *testing.T) { + tests := []testFields{ + { + name: "blocks H+1 and H+2 present - H+1 verification fails ", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}, verBL: []int64{1}}, event: pcProcessBlock{}, + wantState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}, verBL: []int64{1}}, + wantNextEvent: pcBlockVerificationFailure{peerID: "P1", height: 1}, + }, + }, + }, + { + name: "blocks H+1 and H+2 present - H+1 applyBlock fails ", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}, appBL: []int64{1}}, event: pcProcessBlock{}, + wantState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}, appBL: []int64{1}}, wantPanic: true, + }, + }, + }, + } + + executeProcessorTests(t, tests) +} + +func TestPcPeerError(t *testing.T) { + tests := []testFields{ + { + name: "peer not present", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}}, event: &peerError{peerID: "P3"}, + wantState: ¶ms{items: []pcBlock{{"P1", 1}, {"P2", 2}}}, + wantNextEvent: noOp, + }, + }, + }, + { + name: "some blocks are from errored peer", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{items: []pcBlock{{"P1", 100}, {"P1", 99}, {"P2", 101}}}, event: &peerError{peerID: "P1"}, + wantState: ¶ms{items: []pcBlock{{"P2", 101}}}, + wantNextEvent: noOp, + }, + }, + }, + { + name: "all blocks are from errored peer", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{items: []pcBlock{{"P1", 100}, {"P1", 99}}}, event: &peerError{peerID: "P1"}, + wantState: ¶ms{}, + wantNextEvent: noOp, + }, + }, + }, + } + + executeProcessorTests(t, tests) +} + +func TestStop(t *testing.T) { + tests := []testFields{ + { + name: "no blocks", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{height: 100, items: []pcBlock{}, blocksSynced: 100}, event: pcStop{}, + wantState: ¶ms{height: 100, items: []pcBlock{}, blocksSynced: 100}, + wantNextEvent: noOp, + wantErr: pcFinished{height: 100, blocksSynced: 100}, + }, + }, + }, + { + name: "maxHeight+1 block present", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{height: 100, items: []pcBlock{{"P1", 101}}, blocksSynced: 100}, event: pcStop{}, + wantState: ¶ms{height: 100, items: []pcBlock{{"P1", 101}}, blocksSynced: 100}, + wantNextEvent: noOp, + wantErr: pcFinished{height: 100, blocksSynced: 100}, + }, + }, + }, + { + name: "more blocks present", + steps: []pcFsmMakeStateValues{ + { + currentState: ¶ms{height: 100, items: []pcBlock{{"P1", 101}, {"P1", 102}}, blocksSynced: 100}, event: pcStop{}, + wantState: ¶ms{height: 100, items: []pcBlock{{"P1", 101}, {"P1", 102}}, blocksSynced: 100, draining: true}, + wantNextEvent: noOp, + wantErr: nil, + }, + }, + }, + } + + executeProcessorTests(t, tests) +} diff --git a/blockchain/v2/reactor.go b/blockchain/v2/reactor.go new file mode 100644 index 000000000..8f7143083 --- /dev/null +++ b/blockchain/v2/reactor.go @@ -0,0 +1,118 @@ +package v2 + +import ( + "fmt" + "time" + + "github.com/tendermint/tendermint/libs/log" +) + +type timeCheck struct { + priorityHigh + time time.Time +} + +func schedulerHandle(event Event) (Event, error) { + if _, ok := event.(timeCheck); ok { + fmt.Println("scheduler handle timeCheck") + } + return noOp, nil +} + +func processorHandle(event Event) (Event, error) { + if _, ok := event.(timeCheck); ok { + fmt.Println("processor handle timeCheck") + } + return noOp, nil + +} + +type Reactor struct { + events chan Event + stopDemux chan struct{} + scheduler *Routine + processor *Routine + ticker *time.Ticker + logger log.Logger +} + +func NewReactor(bufferSize int) *Reactor { + return &Reactor{ + events: make(chan Event, bufferSize), + stopDemux: make(chan struct{}), + scheduler: newRoutine("scheduler", schedulerHandle, bufferSize), + processor: newRoutine("processor", processorHandle, bufferSize), + ticker: time.NewTicker(1 * time.Second), + logger: log.NewNopLogger(), + } +} + +// nolint:unused +func (r *Reactor) setLogger(logger log.Logger) { + r.logger = logger + r.scheduler.setLogger(logger) + r.processor.setLogger(logger) +} + +func (r *Reactor) Start() { + go r.scheduler.start() + go r.processor.start() + go r.demux() + + <-r.scheduler.ready() + <-r.processor.ready() + + go func() { + for t := range r.ticker.C { + r.events <- timeCheck{time: t} + } + }() +} + +// XXX: How to make this deterministic? +// XXX: Would it be possible here to provide some kind of type safety for the types +// of events that each routine can produce and consume? +func (r *Reactor) demux() { + for { + select { + case event := <-r.events: + // XXX: check for backpressure + r.scheduler.send(event) + r.processor.send(event) + case <-r.stopDemux: + r.logger.Info("demuxing stopped") + return + case event := <-r.scheduler.next(): + r.processor.send(event) + case event := <-r.processor.next(): + r.scheduler.send(event) + case err := <-r.scheduler.final(): + r.logger.Info(fmt.Sprintf("scheduler final %s", err)) + case err := <-r.processor.final(): + r.logger.Info(fmt.Sprintf("processor final %s", err)) + // XXX: switch to consensus + } + } +} + +func (r *Reactor) Stop() { + r.logger.Info("reactor stopping") + + r.ticker.Stop() + r.scheduler.stop() + r.processor.stop() + close(r.stopDemux) + close(r.events) + + r.logger.Info("reactor stopped") +} + +func (r *Reactor) Receive(event Event) { + // XXX: decode and serialize write events + // TODO: backpressure + r.events <- event +} + +func (r *Reactor) AddPeer() { + // TODO: add peer event and send to demuxer +} diff --git a/blockchain/v2/reactor_test.go b/blockchain/v2/reactor_test.go new file mode 100644 index 000000000..46a2e60c6 --- /dev/null +++ b/blockchain/v2/reactor_test.go @@ -0,0 +1,22 @@ +package v2 + +import ( + "testing" +) + +func TestReactor(t *testing.T) { + var ( + bufferSize = 10 + reactor = NewReactor(bufferSize) + ) + + reactor.Start() + script := []Event{ + // TODO + } + + for _, event := range script { + reactor.Receive(event) + } + reactor.Stop() +} diff --git a/blockchain/v2/routine.go b/blockchain/v2/routine.go new file mode 100644 index 000000000..a24a16f09 --- /dev/null +++ b/blockchain/v2/routine.go @@ -0,0 +1,134 @@ +package v2 + +import ( + "fmt" + "sync/atomic" + + "github.com/Workiva/go-datastructures/queue" + "github.com/tendermint/tendermint/libs/log" +) + +type handleFunc = func(event Event) (Event, error) + +// Routines are a structure which model a finite state machine as serialized +// stream of events processed by a handle function. This Routine structure +// handles the concurrency and messaging guarantees. Events are sent via +// `send` are handled by the `handle` function to produce an iterator +// `next()`. Calling `close()` on a routine will conclude processing of all +// sent events and produce `final()` event representing the terminal state. +type Routine struct { + name string + handle handleFunc + queue *queue.PriorityQueue + out chan Event + fin chan error + rdy chan struct{} + running *uint32 + logger log.Logger + metrics *Metrics +} + +func newRoutine(name string, handleFunc handleFunc, bufferSize int) *Routine { + return &Routine{ + name: name, + handle: handleFunc, + queue: queue.NewPriorityQueue(bufferSize, true), + out: make(chan Event, bufferSize), + rdy: make(chan struct{}, 1), + fin: make(chan error, 1), + running: new(uint32), + logger: log.NewNopLogger(), + metrics: NopMetrics(), + } +} + +// nolint: unused +func (rt *Routine) setLogger(logger log.Logger) { + rt.logger = logger +} + +// nolint:unused +func (rt *Routine) setMetrics(metrics *Metrics) { + rt.metrics = metrics +} + +func (rt *Routine) start() { + rt.logger.Info(fmt.Sprintf("%s: run\n", rt.name)) + running := atomic.CompareAndSwapUint32(rt.running, uint32(0), uint32(1)) + if !running { + panic(fmt.Sprintf("%s is already running", rt.name)) + } + close(rt.rdy) + defer func() { + stopped := atomic.CompareAndSwapUint32(rt.running, uint32(1), uint32(0)) + if !stopped { + panic(fmt.Sprintf("%s is failed to stop", rt.name)) + } + }() + + for { + events, err := rt.queue.Get(1) + if err != nil { + rt.logger.Info(fmt.Sprintf("%s: stopping\n", rt.name)) + rt.terminate(fmt.Errorf("stopped")) + return + } + oEvent, err := rt.handle(events[0].(Event)) + rt.metrics.EventsHandled.With("routine", rt.name).Add(1) + if err != nil { + rt.terminate(err) + return + } + rt.metrics.EventsOut.With("routine", rt.name).Add(1) + rt.logger.Debug(fmt.Sprintf("%s produced %T %+v\n", rt.name, oEvent, oEvent)) + + rt.out <- oEvent + } +} + +// XXX: look into returning OpError in the net package +func (rt *Routine) send(event Event) bool { + rt.logger.Debug(fmt.Sprintf("%s: received %T %+v", rt.name, event, event)) + if !rt.isRunning() { + return false + } + err := rt.queue.Put(event) + if err != nil { + rt.metrics.EventsShed.With("routine", rt.name).Add(1) + rt.logger.Info(fmt.Sprintf("%s: send failed, queue was full/stopped \n", rt.name)) + return false + } + rt.metrics.EventsSent.With("routine", rt.name).Add(1) + return true +} + +func (rt *Routine) isRunning() bool { + return atomic.LoadUint32(rt.running) == 1 +} + +func (rt *Routine) next() chan Event { + return rt.out +} + +func (rt *Routine) ready() chan struct{} { + return rt.rdy +} + +func (rt *Routine) stop() { + if !rt.isRunning() { + return + } + + rt.logger.Info(fmt.Sprintf("%s: stop\n", rt.name)) + rt.queue.Dispose() // this should block until all queue items are free? +} + +func (rt *Routine) final() chan error { + return rt.fin +} + +// XXX: Maybe get rid of this +func (rt *Routine) terminate(reason error) { + close(rt.out) + rt.fin <- reason +} diff --git a/blockchain/v2/routine_test.go b/blockchain/v2/routine_test.go new file mode 100644 index 000000000..66a8cc704 --- /dev/null +++ b/blockchain/v2/routine_test.go @@ -0,0 +1,163 @@ +package v2 + +import ( + "fmt" + "testing" + "time" + + "github.com/stretchr/testify/assert" +) + +type eventA struct { + priorityNormal +} + +var done = fmt.Errorf("done") + +func simpleHandler(event Event) (Event, error) { + if _, ok := event.(eventA); ok { + return noOp, done + } + return noOp, nil +} + +func TestRoutineFinal(t *testing.T) { + var ( + bufferSize = 10 + routine = newRoutine("simpleRoutine", simpleHandler, bufferSize) + ) + + assert.False(t, routine.isRunning(), + "expected an initialized routine to not be running") + go routine.start() + <-routine.ready() + assert.True(t, routine.isRunning(), + "expected an started routine") + + assert.True(t, routine.send(eventA{}), + "expected sending to a ready routine to succeed") + + assert.Equal(t, done, <-routine.final(), + "expected the final event to be done") + + assert.False(t, routine.isRunning(), + "expected an completed routine to no longer be running") +} + +func TestRoutineStop(t *testing.T) { + var ( + bufferSize = 10 + routine = newRoutine("simpleRoutine", simpleHandler, bufferSize) + ) + + assert.False(t, routine.send(eventA{}), + "expected sending to an unstarted routine to fail") + + go routine.start() + <-routine.ready() + + assert.True(t, routine.send(eventA{}), + "expected sending to a running routine to succeed") + + routine.stop() + + assert.False(t, routine.send(eventA{}), + "expected sending to a stopped routine to fail") +} + +type finalCount struct { + count int +} + +func (f finalCount) Error() string { + return "end" +} + +func genStatefulHandler(maxCount int) handleFunc { + counter := 0 + return func(event Event) (Event, error) { + if _, ok := event.(eventA); ok { + counter += 1 + if counter >= maxCount { + return noOp, finalCount{counter} + } + + return eventA{}, nil + } + return noOp, nil + } +} + +func feedback(r *Routine) { + for event := range r.next() { + r.send(event) + } +} + +func TestStatefulRoutine(t *testing.T) { + var ( + count = 10 + handler = genStatefulHandler(count) + bufferSize = 20 + routine = newRoutine("statefulRoutine", handler, bufferSize) + ) + + go routine.start() + go feedback(routine) + <-routine.ready() + + assert.True(t, routine.send(eventA{}), + "expected sending to a started routine to succeed") + + final := <-routine.final() + if fnl, ok := final.(finalCount); ok { + assert.Equal(t, count, fnl.count, + "expected the routine to count to 10") + } else { + t.Fail() + } +} + +type lowPriorityEvent struct { + priorityLow +} + +type highPriorityEvent struct { + priorityHigh +} + +func handleWithPriority(event Event) (Event, error) { + switch event.(type) { + case lowPriorityEvent: + return noOp, nil + case highPriorityEvent: + return noOp, done + } + return noOp, nil +} + +func TestPriority(t *testing.T) { + var ( + bufferSize = 20 + routine = newRoutine("priorityRoutine", handleWithPriority, bufferSize) + ) + + go routine.start() + <-routine.ready() + go func() { + for { + routine.send(lowPriorityEvent{}) + time.Sleep(1 * time.Millisecond) + } + }() + time.Sleep(10 * time.Millisecond) + + assert.True(t, routine.isRunning(), + "expected an started routine") + assert.True(t, routine.send(highPriorityEvent{}), + "expected send to succeed even when saturated") + + assert.Equal(t, done, <-routine.final()) + assert.False(t, routine.isRunning(), + "expected an started routine") +} diff --git a/blockchain/v2/schedule.go b/blockchain/v2/schedule.go index 329557492..38c6c5d2d 100644 --- a/blockchain/v2/schedule.go +++ b/blockchain/v2/schedule.go @@ -10,8 +10,6 @@ import ( "github.com/tendermint/tendermint/p2p" ) -type Event interface{} - type blockState int const ( @@ -166,6 +164,7 @@ func (sc *schedule) removePeer(peerID p2p.ID) error { return nil } +// TODO - keep track of highest height func (sc *schedule) setPeerHeight(peerID p2p.ID, height int64) error { peer, ok := sc.peers[peerID] if !ok { diff --git a/blockchain/v2/types.go b/blockchain/v2/types.go new file mode 100644 index 000000000..836e87fd8 --- /dev/null +++ b/blockchain/v2/types.go @@ -0,0 +1,64 @@ +package v2 + +import ( + "github.com/Workiva/go-datastructures/queue" +) + +type Event queue.Item + +type priority interface { + Compare(other queue.Item) int + Priority() int +} + +type priorityLow struct{} +type priorityNormal struct{} +type priorityHigh struct{} + +func (p priorityLow) Priority() int { + return 1 +} + +func (p priorityNormal) Priority() int { + return 2 +} + +func (p priorityHigh) Priority() int { + return 3 +} + +func (p priorityLow) Compare(other queue.Item) int { + op := other.(priority) + if p.Priority() > op.Priority() { + return 1 + } else if p.Priority() == op.Priority() { + return 0 + } + return -1 +} + +func (p priorityNormal) Compare(other queue.Item) int { + op := other.(priority) + if p.Priority() > op.Priority() { + return 1 + } else if p.Priority() == op.Priority() { + return 0 + } + return -1 +} + +func (p priorityHigh) Compare(other queue.Item) int { + op := other.(priority) + if p.Priority() > op.Priority() { + return 1 + } else if p.Priority() == op.Priority() { + return 0 + } + return -1 +} + +type noOpEvent struct { + priorityLow +} + +var noOp = noOpEvent{} diff --git a/cmd/tendermint/commands/lite.go b/cmd/tendermint/commands/lite.go index 906af930b..1cc82ab2e 100644 --- a/cmd/tendermint/commands/lite.go +++ b/cmd/tendermint/commands/lite.go @@ -40,7 +40,11 @@ func init() { LiteCmd.Flags().StringVar(&nodeAddr, "node", "tcp://localhost:26657", "Connect to a Tendermint node at this address") LiteCmd.Flags().StringVar(&chainID, "chain-id", "tendermint", "Specify the Tendermint chain ID") LiteCmd.Flags().StringVar(&home, "home-dir", ".tendermint-lite", "Specify the home directory") - LiteCmd.Flags().IntVar(&maxOpenConnections, "max-open-connections", 900, "Maximum number of simultaneous connections (including WebSocket).") + LiteCmd.Flags().IntVar( + &maxOpenConnections, + "max-open-connections", + 900, + "Maximum number of simultaneous connections (including WebSocket).") LiteCmd.Flags().IntVar(&cacheSize, "cache-size", 10, "Specify the memory trust store cache size") } diff --git a/cmd/tendermint/commands/run_node.go b/cmd/tendermint/commands/run_node.go index 70de9aba7..2faffc5ab 100644 --- a/cmd/tendermint/commands/run_node.go +++ b/cmd/tendermint/commands/run_node.go @@ -16,22 +16,37 @@ func AddNodeFlags(cmd *cobra.Command) { cmd.Flags().String("moniker", config.Moniker, "Node Name") // priv val flags - cmd.Flags().String("priv_validator_laddr", config.PrivValidatorListenAddr, "Socket address to listen on for connections from external priv_validator process") + cmd.Flags().String( + "priv_validator_laddr", + config.PrivValidatorListenAddr, + "Socket address to listen on for connections from external priv_validator process") // node flags cmd.Flags().Bool("fast_sync", config.FastSyncMode, "Fast blockchain syncing") // abci flags - cmd.Flags().String("proxy_app", config.ProxyApp, "Proxy app address, or one of: 'kvstore', 'persistent_kvstore', 'counter', 'counter_serial' or 'noop' for local testing.") + cmd.Flags().String( + "proxy_app", + config.ProxyApp, + "Proxy app address, or one of: 'kvstore',"+ + " 'persistent_kvstore',"+ + " 'counter',"+ + " 'counter_serial' or 'noop' for local testing.") cmd.Flags().String("abci", config.ABCI, "Specify abci transport (socket | grpc)") // rpc flags cmd.Flags().String("rpc.laddr", config.RPC.ListenAddress, "RPC listen address. Port required") - cmd.Flags().String("rpc.grpc_laddr", config.RPC.GRPCListenAddress, "GRPC listen address (BroadcastTx only). Port required") + cmd.Flags().String( + "rpc.grpc_laddr", + config.RPC.GRPCListenAddress, + "GRPC listen address (BroadcastTx only). Port required") cmd.Flags().Bool("rpc.unsafe", config.RPC.Unsafe, "Enabled unsafe rpc methods") // p2p flags - cmd.Flags().String("p2p.laddr", config.P2P.ListenAddress, "Node listen address. (0.0.0.0:0 means any interface, any port)") + cmd.Flags().String( + "p2p.laddr", + config.P2P.ListenAddress, + "Node listen address. (0.0.0.0:0 means any interface, any port)") cmd.Flags().String("p2p.seeds", config.P2P.Seeds, "Comma-delimited ID@host:port seed nodes") cmd.Flags().String("p2p.persistent_peers", config.P2P.PersistentPeers, "Comma-delimited ID@host:port persistent peers") cmd.Flags().Bool("p2p.upnp", config.P2P.UPNP, "Enable/disable UPNP port forwarding") @@ -40,7 +55,10 @@ func AddNodeFlags(cmd *cobra.Command) { cmd.Flags().String("p2p.private_peer_ids", config.P2P.PrivatePeerIDs, "Comma-delimited private peer IDs") // consensus flags - cmd.Flags().Bool("consensus.create_empty_blocks", config.Consensus.CreateEmptyBlocks, "Set this to false to only produce blocks when there are txs or when the AppHash changes") + cmd.Flags().Bool( + "consensus.create_empty_blocks", + config.Consensus.CreateEmptyBlocks, + "Set this to false to only produce blocks when there are txs or when the AppHash changes") } // NewRunNodeCmd returns the command that allows the CLI to start a node. diff --git a/cmd/tendermint/commands/testnet.go b/cmd/tendermint/commands/testnet.go index 5e2dc1a3a..5f199908e 100644 --- a/cmd/tendermint/commands/testnet.go +++ b/cmd/tendermint/commands/testnet.go @@ -51,13 +51,19 @@ func init() { "Prefix the directory name for each node with (node results in node0, node1, ...)") TestnetFilesCmd.Flags().BoolVar(&populatePersistentPeers, "populate-persistent-peers", true, - "Update config of each node with the list of persistent peers build using either hostname-prefix or starting-ip-address") + "Update config of each node with the list of persistent peers build using either"+ + " hostname-prefix or"+ + " starting-ip-address") TestnetFilesCmd.Flags().StringVar(&hostnamePrefix, "hostname-prefix", "node", "Hostname prefix (\"node\" results in persistent peers list ID0@node0:26656, ID1@node1:26656, ...)") TestnetFilesCmd.Flags().StringVar(&hostnameSuffix, "hostname-suffix", "", - "Hostname suffix (\".xyz.com\" results in persistent peers list ID0@node0.xyz.com:26656, ID1@node1.xyz.com:26656, ...)") + "Hostname suffix ("+ + "\".xyz.com\""+ + " results in persistent peers list ID0@node0.xyz.com:26656, ID1@node1.xyz.com:26656, ...)") TestnetFilesCmd.Flags().StringVar(&startingIPAddress, "starting-ip-address", "", - "Starting IP address (\"192.168.0.1\" results in persistent peers list ID0@192.168.0.1:26656, ID1@192.168.0.2:26656, ...)") + "Starting IP address ("+ + "\"192.168.0.1\""+ + " results in persistent peers list ID0@192.168.0.1:26656, ID1@192.168.0.2:26656, ...)") TestnetFilesCmd.Flags().StringArrayVar(&hostnames, "hostname", []string{}, "Manually override all hostnames of validators and non-validators (use --hostname multiple times for multiple hosts)") TestnetFilesCmd.Flags().IntVar(&p2pPort, "p2p-port", 26656, diff --git a/config/config.go b/config/config.go index 3e4bf9340..c5d42c7e8 100644 --- a/config/config.go +++ b/config/config.go @@ -140,7 +140,7 @@ func (cfg *Config) ValidateBasic() error { // BaseConfig // BaseConfig defines the base configuration for a Tendermint node -type BaseConfig struct { +type BaseConfig struct { //nolint: maligned // chainID is unexposed and immutable but here for convenience chainID string @@ -371,13 +371,15 @@ type RPCConfig struct { // the certFile should be the concatenation of the server's certificate, any intermediates, // and the CA's certificate. // - // NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. + // NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. + // Otherwise, HTTP server is run. TLSCertFile string `mapstructure:"tls_cert_file"` // The path to a file containing matching private key that is used to create the HTTPS server. // Migth be either absolute path or path related to tendermint's config directory. // - // NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. + // NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. + // Otherwise, HTTP server is run. TLSKeyFile string `mapstructure:"tls_key_file"` } @@ -471,7 +473,7 @@ func (cfg RPCConfig) IsTLSEnabled() bool { // P2PConfig // P2PConfig defines the configuration options for the Tendermint peer-to-peer networking layer -type P2PConfig struct { +type P2PConfig struct { //nolint: maligned RootDir string `mapstructure:"home"` // Address to listen for incoming connections @@ -814,7 +816,8 @@ func (cfg *ConsensusConfig) Precommit(round int) time.Duration { ) * time.Nanosecond } -// Commit returns the amount of time to wait for straggler votes after receiving +2/3 precommits for a single block (ie. a commit). +// Commit returns the amount of time to wait for straggler votes after receiving +2/3 precommits +// for a single block (ie. a commit). func (cfg *ConsensusConfig) Commit(t time.Time) time.Time { return t.Add(cfg.TimeoutCommit) } @@ -878,7 +881,8 @@ type TxIndexConfig struct { // // Options: // 1) "null" - // 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). + // 2) "kv" (default) - the simplest possible indexer, + // backed by key-value storage (defaults to levelDB; see DBBackend). Indexer string `mapstructure:"indexer"` // Comma-separated list of tags to index (by default the only tag is "tx.hash") diff --git a/config/toml.go b/config/toml.go index 268c96ff9..b9d4b6a8b 100644 --- a/config/toml.go +++ b/config/toml.go @@ -67,6 +67,11 @@ func WriteConfigFile(configFilePath string, config *Config) { const defaultConfigTemplate = `# This is a TOML config file. # For more information, see https://github.com/toml-lang/toml +# NOTE: Any path below can be absolute (e.g. "/var/myawesomeapp/data") or +# relative to the home directory (e.g. "data"). The home directory is +# "$HOME/.tendermint" by default, but could be changed via $TMHOME env variable +# or --home cmd flag. + ##### main base config options ##### # TCP or UNIX socket address of the ABCI application, @@ -203,12 +208,14 @@ max_header_bytes = {{ .RPC.MaxHeaderBytes }} # If the certificate is signed by a certificate authority, # the certFile should be the concatenation of the server's certificate, any intermediates, # and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. +# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. +# Otherwise, HTTP server is run. tls_cert_file = "{{ .RPC.TLSCertFile }}" # The path to a file containing matching private key that is used to create the HTTPS server. # Migth be either absolute path or path related to tendermint's config directory. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. +# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. +# Otherwise, HTTP server is run. tls_key_file = "{{ .RPC.TLSKeyFile }}" ##### peer to peer configuration options ##### diff --git a/consensus/byzantine_test.go b/consensus/byzantine_test.go index 1c52e79ad..1129f69c4 100644 --- a/consensus/byzantine_test.go +++ b/consensus/byzantine_test.go @@ -206,7 +206,14 @@ func byzantineDecideProposalFunc(t *testing.T, height int64, round int, cs *Cons } } -func sendProposalAndParts(height int64, round int, cs *ConsensusState, peer p2p.Peer, proposal *types.Proposal, blockHash []byte, parts *types.PartSet) { +func sendProposalAndParts( + height int64, + round int, + cs *ConsensusState, + peer p2p.Peer, + proposal *types.Proposal, + blockHash []byte, + parts *types.PartSet) { // proposal msg := &ProposalMessage{Proposal: proposal} peer.Send(DataChannel, cdc.MustMarshalBinaryBare(msg)) diff --git a/consensus/common_test.go b/consensus/common_test.go index 61d29d849..2cc3a3288 100644 --- a/consensus/common_test.go +++ b/consensus/common_test.go @@ -77,7 +77,10 @@ func NewValidatorStub(privValidator types.PrivValidator, valIndex int) *validato } } -func (vs *validatorStub) signVote(voteType types.SignedMsgType, hash []byte, header types.PartSetHeader) (*types.Vote, error) { +func (vs *validatorStub) signVote( + voteType types.SignedMsgType, + hash []byte, + header types.PartSetHeader) (*types.Vote, error) { addr := vs.PrivValidator.GetPubKey().Address() vote := &types.Vote{ ValidatorIndex: vs.Index, @@ -101,7 +104,11 @@ func signVote(vs *validatorStub, voteType types.SignedMsgType, hash []byte, head return v } -func signVotes(voteType types.SignedMsgType, hash []byte, header types.PartSetHeader, vss ...*validatorStub) []*types.Vote { +func signVotes( + voteType types.SignedMsgType, + hash []byte, + header types.PartSetHeader, + vss ...*validatorStub) []*types.Vote { votes := make([]*types.Vote, len(vss)) for i, vs := range vss { votes[i] = signVote(vs, voteType, hash, header) @@ -148,7 +155,11 @@ func startTestRound(cs *ConsensusState, height int64, round int) { } // Create proposal block from cs1 but sign it with vs. -func decideProposal(cs1 *ConsensusState, vs *validatorStub, height int64, round int) (proposal *types.Proposal, block *types.Block) { +func decideProposal( + cs1 *ConsensusState, + vs *validatorStub, + height int64, + round int) (proposal *types.Proposal, block *types.Block) { cs1.mtx.Lock() block, blockParts := cs1.createProposalBlock() validRound := cs1.ValidRound @@ -173,7 +184,12 @@ func addVotes(to *ConsensusState, votes ...*types.Vote) { } } -func signAddVotes(to *ConsensusState, voteType types.SignedMsgType, hash []byte, header types.PartSetHeader, vss ...*validatorStub) { +func signAddVotes( + to *ConsensusState, + voteType types.SignedMsgType, + hash []byte, + header types.PartSetHeader, + vss ...*validatorStub) { votes := signVotes(voteType, hash, header, vss...) addVotes(to, votes...) } @@ -208,7 +224,14 @@ func validateLastPrecommit(t *testing.T, cs *ConsensusState, privVal *validatorS } } -func validatePrecommit(t *testing.T, cs *ConsensusState, thisRound, lockRound int, privVal *validatorStub, votedBlockHash, lockedBlockHash []byte) { +func validatePrecommit( + t *testing.T, + cs *ConsensusState, + thisRound, + lockRound int, + privVal *validatorStub, + votedBlockHash, + lockedBlockHash []byte) { precommits := cs.Votes.Precommits(thisRound) address := privVal.GetPubKey().Address() var vote *types.Vote @@ -228,17 +251,33 @@ func validatePrecommit(t *testing.T, cs *ConsensusState, thisRound, lockRound in if lockedBlockHash == nil { if cs.LockedRound != lockRound || cs.LockedBlock != nil { - panic(fmt.Sprintf("Expected to be locked on nil at round %d. Got locked at round %d with block %v", lockRound, cs.LockedRound, cs.LockedBlock)) + panic(fmt.Sprintf( + "Expected to be locked on nil at round %d. Got locked at round %d with block %v", + lockRound, + cs.LockedRound, + cs.LockedBlock)) } } else { if cs.LockedRound != lockRound || !bytes.Equal(cs.LockedBlock.Hash(), lockedBlockHash) { - panic(fmt.Sprintf("Expected block to be locked on round %d, got %d. Got locked block %X, expected %X", lockRound, cs.LockedRound, cs.LockedBlock.Hash(), lockedBlockHash)) + panic(fmt.Sprintf( + "Expected block to be locked on round %d, got %d. Got locked block %X, expected %X", + lockRound, + cs.LockedRound, + cs.LockedBlock.Hash(), + lockedBlockHash)) } } } -func validatePrevoteAndPrecommit(t *testing.T, cs *ConsensusState, thisRound, lockRound int, privVal *validatorStub, votedBlockHash, lockedBlockHash []byte) { +func validatePrevoteAndPrecommit( + t *testing.T, + cs *ConsensusState, + thisRound, + lockRound int, + privVal *validatorStub, + votedBlockHash, + lockedBlockHash []byte) { // verify the prevote validatePrevote(t, cs, thisRound, privVal, votedBlockHash) // verify precommit @@ -273,12 +312,21 @@ func newConsensusState(state sm.State, pv types.PrivValidator, app abci.Applicat return newConsensusStateWithConfig(config, state, pv, app) } -func newConsensusStateWithConfig(thisConfig *cfg.Config, state sm.State, pv types.PrivValidator, app abci.Application) *ConsensusState { +func newConsensusStateWithConfig( + thisConfig *cfg.Config, + state sm.State, + pv types.PrivValidator, + app abci.Application) *ConsensusState { blockDB := dbm.NewMemDB() return newConsensusStateWithConfigAndBlockStore(thisConfig, state, pv, app, blockDB) } -func newConsensusStateWithConfigAndBlockStore(thisConfig *cfg.Config, state sm.State, pv types.PrivValidator, app abci.Application, blockDB dbm.DB) *ConsensusState { +func newConsensusStateWithConfigAndBlockStore( + thisConfig *cfg.Config, + state sm.State, + pv types.PrivValidator, + app abci.Application, + blockDB dbm.DB) *ConsensusState { // Get BlockStore blockStore := store.NewBlockStore(blockDB) @@ -597,7 +645,12 @@ func randConsensusNet(nValidators int, testName string, tickerFunc func() Timeou } // nPeers = nValidators + nNotValidator -func randConsensusNetWithPeers(nValidators, nPeers int, testName string, tickerFunc func() TimeoutTicker, appFunc func(string) abci.Application) ([]*ConsensusState, *types.GenesisDoc, *cfg.Config, cleanupFunc) { +func randConsensusNetWithPeers( + nValidators, + nPeers int, + testName string, + tickerFunc func() TimeoutTicker, + appFunc func(string) abci.Application) ([]*ConsensusState, *types.GenesisDoc, *cfg.Config, cleanupFunc) { genDoc, privVals := randGenesisDoc(nValidators, false, testMinPower) css := make([]*ConsensusState, nPeers) logger := consensusLogger() @@ -631,7 +684,8 @@ func randConsensusNetWithPeers(nValidators, nPeers int, testName string, tickerF app := appFunc(path.Join(config.DBDir(), fmt.Sprintf("%s_%d", testName, i))) vals := types.TM2PB.ValidatorUpdates(state.Validators) if _, ok := app.(*kvstore.PersistentKVStoreApplication); ok { - state.Version.Consensus.App = kvstore.ProtocolVersion //simulate handshake, receive app version. If don't do this, replay test will fail + // simulate handshake, receive app version. If don't do this, replay test will fail + state.Version.Consensus.App = kvstore.ProtocolVersion } app.InitChain(abci.RequestInitChain{Validators: vals}) //sm.SaveState(stateDB,state) //height 1's validatorsInfo already saved in LoadStateFromDBOrGenesisDoc above diff --git a/consensus/mempool_test.go b/consensus/mempool_test.go index c1d4f69a7..aa74a6972 100644 --- a/consensus/mempool_test.go +++ b/consensus/mempool_test.go @@ -99,7 +99,7 @@ func deliverTxsRange(cs *ConsensusState, start, end int) { for i := start; i < end; i++ { txBytes := make([]byte, 8) binary.BigEndian.PutUint64(txBytes, uint64(i)) - err := assertMempool(cs.txNotifier).CheckTx(txBytes, nil) + err := assertMempool(cs.txNotifier).CheckTx(txBytes, nil, mempl.TxInfo{}) if err != nil { panic(fmt.Sprintf("Error after CheckTx: %v", err)) } @@ -123,7 +123,7 @@ func TestMempoolTxConcurrentWithCommit(t *testing.T) { select { case msg := <-newBlockCh: blockEvent := msg.Data().(types.EventDataNewBlock) - nTxs += int(blockEvent.Block.Header.NumTxs) + nTxs += len(blockEvent.Block.Txs) case <-ticker.C: panic("Timed out waiting to commit blocks with transactions") } @@ -159,7 +159,7 @@ func TestMempoolRmBadTx(t *testing.T) { return } checkTxRespCh <- struct{}{} - }) + }, mempl.TxInfo{}) if err != nil { t.Errorf("Error after CheckTx: %v", err) return diff --git a/consensus/reactor.go b/consensus/reactor.go index dc3514b21..6d4b61219 100644 --- a/consensus/reactor.go +++ b/consensus/reactor.go @@ -137,8 +137,9 @@ func (conR *ConsensusReactor) GetChannels() []*p2p.ChannelDescriptor { RecvMessageCapacity: maxMsgSize, }, { - ID: DataChannel, // maybe split between gossiping current block and catchup stuff - Priority: 10, // once we gossip the whole block there's nothing left to send until next height or round + ID: DataChannel, // maybe split between gossiping current block and catchup stuff + // once we gossip the whole block there's nothing left to send until next height or round + Priority: 10, SendQueueCapacity: 100, RecvBufferCapacity: 50 * 4096, RecvMessageCapacity: maxMsgSize, @@ -670,7 +671,11 @@ OUTER_LOOP: } } -func (conR *ConsensusReactor) gossipVotesForHeight(logger log.Logger, rs *cstypes.RoundState, prs *cstypes.PeerRoundState, ps *PeerState) bool { +func (conR *ConsensusReactor) gossipVotesForHeight( + logger log.Logger, + rs *cstypes.RoundState, + prs *cstypes.PeerRoundState, + ps *PeerState) bool { // If there are lastCommits to send... if prs.Step == cstypes.RoundStepNewHeight { @@ -1119,7 +1124,13 @@ func (ps *PeerState) ensureCatchupCommitRound(height int64, round int, numValida NOTE: This is wrong, 'round' could change. e.g. if orig round is not the same as block LastCommit round. if ps.CatchupCommitRound != -1 && ps.CatchupCommitRound != round { - panic(fmt.Sprintf("Conflicting CatchupCommitRound. Height: %v, Orig: %v, New: %v", height, ps.CatchupCommitRound, round)) + panic(fmt.Sprintf( + "Conflicting CatchupCommitRound. Height: %v, + Orig: %v, + New: %v", + height, + ps.CatchupCommitRound, + round)) } */ if ps.PRS.CatchupCommitRound == round { @@ -1211,7 +1222,11 @@ func (ps *PeerState) SetHasVote(vote *types.Vote) { } func (ps *PeerState) setHasVote(height int64, round int, type_ types.SignedMsgType, index int) { - logger := ps.logger.With("peerH/R", fmt.Sprintf("%d/%d", ps.PRS.Height, ps.PRS.Round), "H/R", fmt.Sprintf("%d/%d", height, round)) + logger := ps.logger.With( + "peerH/R", + fmt.Sprintf("%d/%d", ps.PRS.Height, ps.PRS.Round), + "H/R", + fmt.Sprintf("%d/%d", height, round)) logger.Debug("setHasVote", "type", type_, "index", index) // NOTE: some may be nil BitArrays -> no side effects. @@ -1453,11 +1468,17 @@ func (m *NewValidBlockMessage) ValidateBasic() error { if err := m.BlockPartsHeader.ValidateBasic(); err != nil { return fmt.Errorf("Wrong BlockPartsHeader: %v", err) } + if m.BlockParts.Size() == 0 { + return errors.New("Empty BlockParts") + } if m.BlockParts.Size() != m.BlockPartsHeader.Total { return fmt.Errorf("BlockParts bit array size %d not equal to BlockPartsHeader.Total %d", m.BlockParts.Size(), m.BlockPartsHeader.Total) } + if m.BlockParts.Size() > types.MaxBlockPartsCount { + return errors.Errorf("BlockParts bit array is too big: %d, max: %d", m.BlockParts.Size(), types.MaxBlockPartsCount) + } return nil } @@ -1504,6 +1525,9 @@ func (m *ProposalPOLMessage) ValidateBasic() error { if m.ProposalPOL.Size() == 0 { return errors.New("Empty ProposalPOL bit array") } + if m.ProposalPOL.Size() > types.MaxVotesCount { + return errors.Errorf("ProposalPOL bit array is too big: %d, max: %d", m.ProposalPOL.Size(), types.MaxVotesCount) + } return nil } @@ -1647,6 +1671,9 @@ func (m *VoteSetBitsMessage) ValidateBasic() error { return fmt.Errorf("Wrong BlockID: %v", err) } // NOTE: Votes.Size() can be zero if the node does not have any + if m.Votes.Size() > types.MaxVotesCount { + return fmt.Errorf("Votes bit array is too big: %d, max: %d", m.Votes.Size(), types.MaxVotesCount) + } return nil } diff --git a/consensus/reactor_test.go b/consensus/reactor_test.go index 168f07924..b9ff6ea78 100644 --- a/consensus/reactor_test.go +++ b/consensus/reactor_test.go @@ -19,6 +19,7 @@ import ( abci "github.com/tendermint/tendermint/abci/types" cfg "github.com/tendermint/tendermint/config" cstypes "github.com/tendermint/tendermint/consensus/types" + "github.com/tendermint/tendermint/crypto/tmhash" cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/libs/log" mempl "github.com/tendermint/tendermint/mempool" @@ -236,7 +237,7 @@ func TestReactorCreatesBlockWhenEmptyBlocksFalse(t *testing.T) { defer stopConsensusNet(log.TestingLogger(), reactors, eventBuses) // send a tx - if err := assertMempool(css[3].txNotifier).CheckTx([]byte{1, 2, 3}, nil); err != nil { + if err := assertMempool(css[3].txNotifier).CheckTx([]byte{1, 2, 3}, nil, mempl.TxInfo{}); err != nil { t.Error(err) } @@ -317,7 +318,11 @@ func TestReactorRecordsVotesAndBlockParts(t *testing.T) { func TestReactorVotingPowerChange(t *testing.T) { nVals := 4 logger := log.TestingLogger() - css, cleanup := randConsensusNet(nVals, "consensus_voting_power_changes_test", newMockTickerFunc(true), newPersistentKVStore) + css, cleanup := randConsensusNet( + nVals, + "consensus_voting_power_changes_test", + newMockTickerFunc(true), + newPersistentKVStore) defer cleanup() reactors, blocksSubs, eventBuses := startConsensusNet(t, css, nVals) defer stopConsensusNet(logger, reactors, eventBuses) @@ -348,7 +353,10 @@ func TestReactorVotingPowerChange(t *testing.T) { waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) if css[0].GetRoundState().LastValidators.TotalVotingPower() == previousTotalVotingPower { - t.Fatalf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[0].GetRoundState().LastValidators.TotalVotingPower()) + t.Fatalf( + "expected voting power to change (before: %d, after: %d)", + previousTotalVotingPower, + css[0].GetRoundState().LastValidators.TotalVotingPower()) } updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 2) @@ -360,7 +368,10 @@ func TestReactorVotingPowerChange(t *testing.T) { waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) if css[0].GetRoundState().LastValidators.TotalVotingPower() == previousTotalVotingPower { - t.Fatalf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[0].GetRoundState().LastValidators.TotalVotingPower()) + t.Fatalf( + "expected voting power to change (before: %d, after: %d)", + previousTotalVotingPower, + css[0].GetRoundState().LastValidators.TotalVotingPower()) } updateValidatorTx = kvstore.MakeValSetChangeTx(val1PubKeyABCI, 26) @@ -372,14 +383,22 @@ func TestReactorVotingPowerChange(t *testing.T) { waitForAndValidateBlock(t, nVals, activeVals, blocksSubs, css) if css[0].GetRoundState().LastValidators.TotalVotingPower() == previousTotalVotingPower { - t.Fatalf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[0].GetRoundState().LastValidators.TotalVotingPower()) + t.Fatalf( + "expected voting power to change (before: %d, after: %d)", + previousTotalVotingPower, + css[0].GetRoundState().LastValidators.TotalVotingPower()) } } func TestReactorValidatorSetChanges(t *testing.T) { nPeers := 7 nVals := 4 - css, _, _, cleanup := randConsensusNetWithPeers(nVals, nPeers, "consensus_val_set_changes_test", newMockTickerFunc(true), newPersistentKVStoreWithPath) + css, _, _, cleanup := randConsensusNetWithPeers( + nVals, + nPeers, + "consensus_val_set_changes_test", + newMockTickerFunc(true), + newPersistentKVStoreWithPath) defer cleanup() logger := log.TestingLogger() @@ -440,7 +459,10 @@ func TestReactorValidatorSetChanges(t *testing.T) { waitForBlockWithUpdatedValsAndValidateIt(t, nPeers, activeVals, blocksSubs, css) if css[nVals].GetRoundState().LastValidators.TotalVotingPower() == previousTotalVotingPower { - t.Errorf("expected voting power to change (before: %d, after: %d)", previousTotalVotingPower, css[nVals].GetRoundState().LastValidators.TotalVotingPower()) + t.Errorf( + "expected voting power to change (before: %d, after: %d)", + previousTotalVotingPower, + css[nVals].GetRoundState().LastValidators.TotalVotingPower()) } //--------------------------------------------------------------------------- @@ -510,7 +532,7 @@ func waitForAndValidateBlock( err := validateBlock(newBlock, activeVals) assert.Nil(t, err) for _, tx := range txs { - err := assertMempool(css[j].txNotifier).CheckTx(tx, nil) + err := assertMempool(css[j].txNotifier).CheckTx(tx, nil, mempl.TxInfo{}) assert.Nil(t, err) } }, css) @@ -570,7 +592,10 @@ func waitForBlockWithUpdatedValsAndValidateIt( css[j].Logger.Debug("waitForBlockWithUpdatedValsAndValidateIt: Got block", "height", newBlock.Height) break LOOP } else { - css[j].Logger.Debug("waitForBlockWithUpdatedValsAndValidateIt: Got block with no new validators. Skipping", "height", newBlock.Height) + css[j].Logger.Debug( + "waitForBlockWithUpdatedValsAndValidateIt: Got block with no new validators. Skipping", + "height", + newBlock.Height) } } @@ -582,7 +607,10 @@ func waitForBlockWithUpdatedValsAndValidateIt( // expects high synchrony! func validateBlock(block *types.Block, activeVals map[string]struct{}) error { if block.LastCommit.Size() != len(activeVals) { - return fmt.Errorf("Commit size doesn't match number of active validators. Got %d, expected %d", block.LastCommit.Size(), len(activeVals)) + return fmt.Errorf( + "Commit size doesn't match number of active validators. Got %d, expected %d", + block.LastCommit.Size(), + len(activeVals)) } for _, vote := range block.LastCommit.Precommits { @@ -639,20 +667,20 @@ func capture() { // Ensure basic validation of structs is functioning func TestNewRoundStepMessageValidateBasic(t *testing.T) { - testCases := []struct { - testName string - messageHeight int64 - messageRound int - messageStep cstypes.RoundStepType - messageLastCommitRound int + testCases := []struct { // nolint: maligned expectErr bool + messageRound int + messageLastCommitRound int + messageHeight int64 + testName string + messageStep cstypes.RoundStepType }{ - {"Valid Message", 0, 0, 0x01, 1, false}, - {"Invalid Message", -1, 0, 0x01, 1, true}, - {"Invalid Message", 0, -1, 0x01, 1, true}, - {"Invalid Message", 0, 0, 0x00, 1, true}, - {"Invalid Message", 0, 0, 0x00, 0, true}, - {"Invalid Message", 1, 0, 0x01, 0, true}, + {false, 0, 0, 0, "Valid Message", 0x01}, + {true, -1, 0, 0, "Invalid Message", 0x01}, + {true, 0, 0, -1, "Invalid Message", 0x01}, + {true, 0, 0, 1, "Invalid Message", 0x00}, + {true, 0, 0, 1, "Invalid Message", 0x00}, + {true, 0, -2, 2, "Invalid Message", 0x01}, } for _, tc := range testCases { @@ -671,67 +699,82 @@ func TestNewRoundStepMessageValidateBasic(t *testing.T) { } func TestNewValidBlockMessageValidateBasic(t *testing.T) { - testBitArray := cmn.NewBitArray(1) testCases := []struct { - testName string - messageHeight int64 - messageRound int - messageBlockParts *cmn.BitArray - expectErr bool + malleateFn func(*NewValidBlockMessage) + expErr string }{ - {"Valid Message", 0, 0, testBitArray, false}, - {"Invalid Message", -1, 0, testBitArray, true}, - {"Invalid Message", 0, -1, testBitArray, true}, - {"Invalid Message", 0, 0, cmn.NewBitArray(0), true}, + {func(msg *NewValidBlockMessage) {}, ""}, + {func(msg *NewValidBlockMessage) { msg.Height = -1 }, "Negative Height"}, + {func(msg *NewValidBlockMessage) { msg.Round = -1 }, "Negative Round"}, + { + func(msg *NewValidBlockMessage) { msg.BlockPartsHeader.Total = 2 }, + "BlockParts bit array size 1 not equal to BlockPartsHeader.Total 2", + }, + { + func(msg *NewValidBlockMessage) { msg.BlockPartsHeader.Total = 0; msg.BlockParts = cmn.NewBitArray(0) }, + "Empty BlockParts", + }, + { + func(msg *NewValidBlockMessage) { msg.BlockParts = cmn.NewBitArray(types.MaxBlockPartsCount + 1) }, + "BlockParts bit array size 1602 not equal to BlockPartsHeader.Total 1", + }, } - for _, tc := range testCases { + for i, tc := range testCases { tc := tc - t.Run(tc.testName, func(t *testing.T) { - message := NewValidBlockMessage{ - Height: tc.messageHeight, - Round: tc.messageRound, - BlockParts: tc.messageBlockParts, + t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { + msg := &NewValidBlockMessage{ + Height: 1, + Round: 0, + BlockPartsHeader: types.PartSetHeader{ + Total: 1, + }, + BlockParts: cmn.NewBitArray(1), } - message.BlockPartsHeader.Total = 1 - - assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") + tc.malleateFn(msg) + err := msg.ValidateBasic() + if tc.expErr != "" && assert.Error(t, err) { + assert.Contains(t, err.Error(), tc.expErr) + } }) } } func TestProposalPOLMessageValidateBasic(t *testing.T) { - testBitArray := cmn.NewBitArray(1) testCases := []struct { - testName string - messageHeight int64 - messageProposalPOLRound int - messageProposalPOL *cmn.BitArray - expectErr bool + malleateFn func(*ProposalPOLMessage) + expErr string }{ - {"Valid Message", 0, 0, testBitArray, false}, - {"Invalid Message", -1, 0, testBitArray, true}, - {"Invalid Message", 0, -1, testBitArray, true}, - {"Invalid Message", 0, 0, cmn.NewBitArray(0), true}, + {func(msg *ProposalPOLMessage) {}, ""}, + {func(msg *ProposalPOLMessage) { msg.Height = -1 }, "Negative Height"}, + {func(msg *ProposalPOLMessage) { msg.ProposalPOLRound = -1 }, "Negative ProposalPOLRound"}, + {func(msg *ProposalPOLMessage) { msg.ProposalPOL = cmn.NewBitArray(0) }, "Empty ProposalPOL bit array"}, + {func(msg *ProposalPOLMessage) { msg.ProposalPOL = cmn.NewBitArray(types.MaxVotesCount + 1) }, + "ProposalPOL bit array is too big: 10001, max: 10000"}, } - for _, tc := range testCases { + for i, tc := range testCases { tc := tc - t.Run(tc.testName, func(t *testing.T) { - message := ProposalPOLMessage{ - Height: tc.messageHeight, - ProposalPOLRound: tc.messageProposalPOLRound, - ProposalPOL: tc.messageProposalPOL, + t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { + msg := &ProposalPOLMessage{ + Height: 1, + ProposalPOLRound: 1, + ProposalPOL: cmn.NewBitArray(1), } - assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") + tc.malleateFn(msg) + err := msg.ValidateBasic() + if tc.expErr != "" && assert.Error(t, err) { + assert.Contains(t, err.Error(), tc.expErr) + } }) } } func TestBlockPartMessageValidateBasic(t *testing.T) { testPart := new(types.Part) + testPart.Proof.LeafHash = tmhash.Sum([]byte("leaf")) testCases := []struct { testName string messageHeight int64 @@ -769,19 +812,19 @@ func TestHasVoteMessageValidateBasic(t *testing.T) { invalidSignedMsgType types.SignedMsgType = 0x03 ) - testCases := []struct { - testName string - messageHeight int64 - messageRound int - messageType types.SignedMsgType - messageIndex int + testCases := []struct { // nolint: maligned expectErr bool + messageRound int + messageIndex int + messageHeight int64 + testName string + messageType types.SignedMsgType }{ - {"Valid Message", 0, 0, validSignedMsgType, 0, false}, - {"Invalid Message", -1, 0, validSignedMsgType, 0, true}, - {"Invalid Message", 0, -1, validSignedMsgType, 0, true}, - {"Invalid Message", 0, 0, invalidSignedMsgType, 0, true}, - {"Invalid Message", 0, 0, validSignedMsgType, -1, true}, + {false, 0, 0, 0, "Valid Message", validSignedMsgType}, + {true, -1, 0, 0, "Invalid Message", validSignedMsgType}, + {true, 0, -1, 0, "Invalid Message", validSignedMsgType}, + {true, 0, 0, 0, "Invalid Message", invalidSignedMsgType}, + {true, 0, 0, -1, "Invalid Message", validSignedMsgType}, } for _, tc := range testCases { @@ -814,19 +857,19 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { }, } - testCases := []struct { - testName string - messageHeight int64 + testCases := []struct { // nolint: maligned + expectErr bool messageRound int + messageHeight int64 + testName string messageType types.SignedMsgType messageBlockID types.BlockID - expectErr bool }{ - {"Valid Message", 0, 0, validSignedMsgType, validBlockID, false}, - {"Invalid Message", -1, 0, validSignedMsgType, validBlockID, true}, - {"Invalid Message", 0, -1, validSignedMsgType, validBlockID, true}, - {"Invalid Message", 0, 0, invalidSignedMsgType, validBlockID, true}, - {"Invalid Message", 0, 0, validSignedMsgType, invalidBlockID, true}, + {false, 0, 0, "Valid Message", validSignedMsgType, validBlockID}, + {true, -1, 0, "Invalid Message", validSignedMsgType, validBlockID}, + {true, 0, -1, "Invalid Message", validSignedMsgType, validBlockID}, + {true, 0, 0, "Invalid Message", invalidSignedMsgType, validBlockID}, + {true, 0, 0, "Invalid Message", validSignedMsgType, invalidBlockID}, } for _, tc := range testCases { @@ -845,49 +888,43 @@ func TestVoteSetMaj23MessageValidateBasic(t *testing.T) { } func TestVoteSetBitsMessageValidateBasic(t *testing.T) { - const ( - validSignedMsgType types.SignedMsgType = 0x01 - invalidSignedMsgType types.SignedMsgType = 0x03 - ) - - validBlockID := types.BlockID{} - invalidBlockID := types.BlockID{ - Hash: cmn.HexBytes{}, - PartsHeader: types.PartSetHeader{ - Total: -1, - Hash: cmn.HexBytes{}, - }, - } - testBitArray := cmn.NewBitArray(1) - - testCases := []struct { - testName string - messageHeight int64 - messageRound int - messageType types.SignedMsgType - messageBlockID types.BlockID - messageVotes *cmn.BitArray - expectErr bool + testCases := []struct { // nolint: maligned + malleateFn func(*VoteSetBitsMessage) + expErr string }{ - {"Valid Message", 0, 0, validSignedMsgType, validBlockID, testBitArray, false}, - {"Invalid Message", -1, 0, validSignedMsgType, validBlockID, testBitArray, true}, - {"Invalid Message", 0, -1, validSignedMsgType, validBlockID, testBitArray, true}, - {"Invalid Message", 0, 0, invalidSignedMsgType, validBlockID, testBitArray, true}, - {"Invalid Message", 0, 0, validSignedMsgType, invalidBlockID, testBitArray, true}, + {func(msg *VoteSetBitsMessage) {}, ""}, + {func(msg *VoteSetBitsMessage) { msg.Height = -1 }, "Negative Height"}, + {func(msg *VoteSetBitsMessage) { msg.Round = -1 }, "Negative Round"}, + {func(msg *VoteSetBitsMessage) { msg.Type = 0x03 }, "Invalid Type"}, + {func(msg *VoteSetBitsMessage) { + msg.BlockID = types.BlockID{ + Hash: cmn.HexBytes{}, + PartsHeader: types.PartSetHeader{ + Total: -1, + Hash: cmn.HexBytes{}, + }, + } + }, "Wrong BlockID: Wrong PartsHeader: Negative Total"}, + {func(msg *VoteSetBitsMessage) { msg.Votes = cmn.NewBitArray(types.MaxVotesCount + 1) }, + "Votes bit array is too big: 10001, max: 10000"}, } - for _, tc := range testCases { + for i, tc := range testCases { tc := tc - t.Run(tc.testName, func(t *testing.T) { - message := VoteSetBitsMessage{ - Height: tc.messageHeight, - Round: tc.messageRound, - Type: tc.messageType, - // Votes: tc.messageVotes, - BlockID: tc.messageBlockID, + t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { + msg := &VoteSetBitsMessage{ + Height: 1, + Round: 0, + Type: 0x01, + Votes: cmn.NewBitArray(1), + BlockID: types.BlockID{}, } - assert.Equal(t, tc.expectErr, message.ValidateBasic() != nil, "Validate Basic had an unexpected result") + tc.malleateFn(msg) + err := msg.ValidateBasic() + if tc.expErr != "" && assert.Error(t, err) { + assert.Contains(t, err.Error(), tc.expErr) + } }) } } diff --git a/consensus/replay.go b/consensus/replay.go index 83c6b3d40..a4c0aef19 100644 --- a/consensus/replay.go +++ b/consensus/replay.go @@ -290,7 +290,14 @@ func (h *Handshaker) ReplayBlocks( ) ([]byte, error) { storeBlockHeight := h.store.Height() stateBlockHeight := state.LastBlockHeight - h.logger.Info("ABCI Replay Blocks", "appHeight", appBlockHeight, "storeHeight", storeBlockHeight, "stateHeight", stateBlockHeight) + h.logger.Info( + "ABCI Replay Blocks", + "appHeight", + appBlockHeight, + "storeHeight", + storeBlockHeight, + "stateHeight", + stateBlockHeight) // If appBlockHeight == 0 it means that we are at genesis and hence should send InitChain. if appBlockHeight == 0 { @@ -405,7 +412,12 @@ func (h *Handshaker) ReplayBlocks( appBlockHeight, storeBlockHeight, stateBlockHeight)) } -func (h *Handshaker) replayBlocks(state sm.State, proxyApp proxy.AppConns, appBlockHeight, storeBlockHeight int64, mutateState bool) ([]byte, error) { +func (h *Handshaker) replayBlocks( + state sm.State, + proxyApp proxy.AppConns, + appBlockHeight, + storeBlockHeight int64, + mutateState bool) ([]byte, error) { // App is further behind than it should be, so we need to replay blocks. // We replay all blocks from appBlockHeight+1. // @@ -518,7 +530,7 @@ type mockProxyApp struct { } func (mock *mockProxyApp) DeliverTx(req abci.RequestDeliverTx) abci.ResponseDeliverTx { - r := mock.abciResponses.DeliverTx[mock.txCount] + r := mock.abciResponses.DeliverTxs[mock.txCount] mock.txCount++ if r == nil { //it could be nil because of amino unMarshall, it will cause an empty ResponseDeliverTx to become nil return abci.ResponseDeliverTx{} diff --git a/consensus/replay_test.go b/consensus/replay_test.go index b308e4946..6a804c307 100644 --- a/consensus/replay_test.go +++ b/consensus/replay_test.go @@ -23,6 +23,7 @@ import ( "github.com/tendermint/tendermint/crypto" cmn "github.com/tendermint/tendermint/libs/common" "github.com/tendermint/tendermint/libs/log" + mempl "github.com/tendermint/tendermint/mempool" "github.com/tendermint/tendermint/mock" "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/proxy" @@ -67,7 +68,12 @@ func startNewConsensusStateAndWaitForBlock(t *testing.T, consensusReplayConfig * logger := log.TestingLogger() state, _ := sm.LoadStateFromDBOrGenesisFile(stateDB, consensusReplayConfig.GenesisFile()) privValidator := loadPrivValidator(consensusReplayConfig) - cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, kvstore.NewKVStoreApplication(), blockDB) + cs := newConsensusStateWithConfigAndBlockStore( + consensusReplayConfig, + state, + privValidator, + kvstore.NewKVStoreApplication(), + blockDB) cs.SetLogger(logger) bytes, _ := ioutil.ReadFile(cs.config.WalFile()) @@ -99,7 +105,7 @@ func sendTxs(ctx context.Context, cs *ConsensusState) { return default: tx := []byte{byte(i)} - assertMempool(cs.txNotifier).CheckTx(tx, nil) + assertMempool(cs.txNotifier).CheckTx(tx, nil, mempl.TxInfo{}) i++ } } @@ -147,7 +153,12 @@ LOOP: stateDB := blockDB state, _ := sm.MakeGenesisStateFromFile(consensusReplayConfig.GenesisFile()) privValidator := loadPrivValidator(consensusReplayConfig) - cs := newConsensusStateWithConfigAndBlockStore(consensusReplayConfig, state, privValidator, kvstore.NewKVStoreApplication(), blockDB) + cs := newConsensusStateWithConfigAndBlockStore( + consensusReplayConfig, + state, + privValidator, + kvstore.NewKVStoreApplication(), + blockDB) cs.SetLogger(logger) // start sending transactions @@ -228,15 +239,15 @@ func (e ReachedHeightToStopError) Error() string { // Write simulate WAL's crashing by sending an error to the panicCh and then // exiting the cs.receiveRoutine. -func (w *crashingWAL) Write(m WALMessage) { +func (w *crashingWAL) Write(m WALMessage) error { if endMsg, ok := m.(EndHeightMessage); ok { if endMsg.Height == w.heightToStop { w.panicCh <- ReachedHeightToStopError{endMsg.Height} runtime.Goexit() - } else { - w.next.Write(m) + return nil } - return + + return w.next.Write(m) } if w.msgIndex > w.lastPanickedForMsgIndex { @@ -244,19 +255,22 @@ func (w *crashingWAL) Write(m WALMessage) { _, file, line, _ := runtime.Caller(1) w.panicCh <- WALWriteError{fmt.Sprintf("failed to write %T to WAL (fileline: %s:%d)", m, file, line)} runtime.Goexit() - } else { - w.msgIndex++ - w.next.Write(m) + return nil } + + w.msgIndex++ + return w.next.Write(m) } -func (w *crashingWAL) WriteSync(m WALMessage) { - w.Write(m) +func (w *crashingWAL) WriteSync(m WALMessage) error { + return w.Write(m) } func (w *crashingWAL) FlushAndSync() error { return w.next.FlushAndSync() } -func (w *crashingWAL) SearchForEndHeight(height int64, options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { +func (w *crashingWAL) SearchForEndHeight( + height int64, + options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { return w.next.SearchForEndHeight(height, options) } @@ -296,7 +310,12 @@ var modes = []uint{0, 1, 2} func TestSimulateValidatorsChange(t *testing.T) { nPeers := 7 nVals := 4 - css, genDoc, config, cleanup := randConsensusNetWithPeers(nVals, nPeers, "replay_test", newMockTickerFunc(true), newPersistentKVStoreWithPath) + css, genDoc, config, cleanup := randConsensusNetWithPeers( + nVals, + nPeers, + "replay_test", + newMockTickerFunc(true), + newPersistentKVStoreWithPath) sim.Config = config sim.GenesisState, _ = sm.MakeGenesisState(genDoc) sim.CleanupFunc = cleanup @@ -326,7 +345,7 @@ func TestSimulateValidatorsChange(t *testing.T) { newValidatorPubKey1 := css[nVals].privValidator.GetPubKey() valPubKey1ABCI := types.TM2PB.PubKey(newValidatorPubKey1) newValidatorTx1 := kvstore.MakeValSetChangeTx(valPubKey1ABCI, testMinPower) - err := assertMempool(css[0].txNotifier).CheckTx(newValidatorTx1, nil) + err := assertMempool(css[0].txNotifier).CheckTx(newValidatorTx1, nil, mempl.TxInfo{}) assert.Nil(t, err) propBlock, _ := css[0].createProposalBlock() //changeProposer(t, cs1, vs2) propBlockParts := propBlock.MakePartSet(partSize) @@ -351,7 +370,7 @@ func TestSimulateValidatorsChange(t *testing.T) { updateValidatorPubKey1 := css[nVals].privValidator.GetPubKey() updatePubKey1ABCI := types.TM2PB.PubKey(updateValidatorPubKey1) updateValidatorTx1 := kvstore.MakeValSetChangeTx(updatePubKey1ABCI, 25) - err = assertMempool(css[0].txNotifier).CheckTx(updateValidatorTx1, nil) + err = assertMempool(css[0].txNotifier).CheckTx(updateValidatorTx1, nil, mempl.TxInfo{}) assert.Nil(t, err) propBlock, _ = css[0].createProposalBlock() //changeProposer(t, cs1, vs2) propBlockParts = propBlock.MakePartSet(partSize) @@ -376,12 +395,12 @@ func TestSimulateValidatorsChange(t *testing.T) { newValidatorPubKey2 := css[nVals+1].privValidator.GetPubKey() newVal2ABCI := types.TM2PB.PubKey(newValidatorPubKey2) newValidatorTx2 := kvstore.MakeValSetChangeTx(newVal2ABCI, testMinPower) - err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx2, nil) + err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx2, nil, mempl.TxInfo{}) assert.Nil(t, err) newValidatorPubKey3 := css[nVals+2].privValidator.GetPubKey() newVal3ABCI := types.TM2PB.PubKey(newValidatorPubKey3) newValidatorTx3 := kvstore.MakeValSetChangeTx(newVal3ABCI, testMinPower) - err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx3, nil) + err = assertMempool(css[0].txNotifier).CheckTx(newValidatorTx3, nil, mempl.TxInfo{}) assert.Nil(t, err) propBlock, _ = css[0].createProposalBlock() //changeProposer(t, cs1, vs2) propBlockParts = propBlock.MakePartSet(partSize) @@ -409,7 +428,7 @@ func TestSimulateValidatorsChange(t *testing.T) { ensureNewProposal(proposalCh, height, round) removeValidatorTx2 := kvstore.MakeValSetChangeTx(newVal2ABCI, 0) - err = assertMempool(css[0].txNotifier).CheckTx(removeValidatorTx2, nil) + err = assertMempool(css[0].txNotifier).CheckTx(removeValidatorTx2, nil, mempl.TxInfo{}) assert.Nil(t, err) rs = css[0].GetRoundState() @@ -439,7 +458,7 @@ func TestSimulateValidatorsChange(t *testing.T) { height++ incrementHeight(vss...) removeValidatorTx3 := kvstore.MakeValSetChangeTx(newVal3ABCI, 0) - err = assertMempool(css[0].txNotifier).CheckTx(removeValidatorTx3, nil) + err = assertMempool(css[0].txNotifier).CheckTx(removeValidatorTx3, nil, mempl.TxInfo{}) assert.Nil(t, err) propBlock, _ = css[0].createProposalBlock() //changeProposer(t, cs1, vs2) propBlockParts = propBlock.MakePartSet(partSize) @@ -529,8 +548,8 @@ func TestMockProxyApp(t *testing.T) { assert.NotPanics(t, func() { abciResWithEmptyDeliverTx := new(sm.ABCIResponses) - abciResWithEmptyDeliverTx.DeliverTx = make([]*abci.ResponseDeliverTx, 0) - abciResWithEmptyDeliverTx.DeliverTx = append(abciResWithEmptyDeliverTx.DeliverTx, &abci.ResponseDeliverTx{}) + abciResWithEmptyDeliverTx.DeliverTxs = make([]*abci.ResponseDeliverTx, 0) + abciResWithEmptyDeliverTx.DeliverTxs = append(abciResWithEmptyDeliverTx.DeliverTxs, &abci.ResponseDeliverTx{}) // called when saveABCIResponses: bytes := cdc.MustMarshalBinaryBare(abciResWithEmptyDeliverTx) @@ -543,7 +562,7 @@ func TestMockProxyApp(t *testing.T) { mock := newMockProxyApp([]byte("mock_hash"), loadedAbciRes) abciRes := new(sm.ABCIResponses) - abciRes.DeliverTx = make([]*abci.ResponseDeliverTx, len(loadedAbciRes.DeliverTx)) + abciRes.DeliverTxs = make([]*abci.ResponseDeliverTx, len(loadedAbciRes.DeliverTxs)) // Execute transactions and get hash. proxyCb := func(req *abci.Request, res *abci.Response) { if r, ok := res.Value.(*abci.Response_DeliverTx); ok { @@ -557,7 +576,7 @@ func TestMockProxyApp(t *testing.T) { logger.Debug("Invalid tx", "code", txRes.Code, "log", txRes.Log) invalidTxs++ } - abciRes.DeliverTx[txIndex] = txRes + abciRes.DeliverTxs[txIndex] = txRes txIndex++ } } @@ -585,7 +604,8 @@ func tempWALWithData(data []byte) string { return walFile.Name() } -// Make some blocks. Start a fresh app and apply nBlocks blocks. Then restart the app and sync it up with the remaining blocks +// Make some blocks. Start a fresh app and apply nBlocks blocks. +// Then restart the app and sync it up with the remaining blocks func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uint, testValidatorsChange bool) { var chain []*types.Block var commits []*types.Commit @@ -631,7 +651,8 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin latestAppHash := state.AppHash // make a new client creator - kvstoreApp := kvstore.NewPersistentKVStoreApplication(filepath.Join(config.DBDir(), fmt.Sprintf("replay_test_%d_%d_a", nBlocks, mode))) + kvstoreApp := kvstore.NewPersistentKVStoreApplication( + filepath.Join(config.DBDir(), fmt.Sprintf("replay_test_%d_%d_a", nBlocks, mode))) clientCreator2 := proxy.NewLocalClientCreator(kvstoreApp) if nBlocks > 0 { @@ -663,7 +684,10 @@ func testHandshakeReplay(t *testing.T, config *cfg.Config, nBlocks int, mode uin // the app hash should be synced up if !bytes.Equal(latestAppHash, res.LastBlockAppHash) { - t.Fatalf("Expected app hashes to match after handshake/replay. got %X, expected %X", res.LastBlockAppHash, latestAppHash) + t.Fatalf( + "Expected app hashes to match after handshake/replay. got %X, expected %X", + res.LastBlockAppHash, + latestAppHash) } expectedBlocksToSync := numBlocks - nBlocks @@ -728,9 +752,17 @@ func buildAppStateFromChain(proxyApp proxy.AppConns, stateDB dbm.DB, } -func buildTMStateFromChain(config *cfg.Config, stateDB dbm.DB, state sm.State, chain []*types.Block, nBlocks int, mode uint) sm.State { +func buildTMStateFromChain( + config *cfg.Config, + stateDB dbm.DB, + state sm.State, + chain []*types.Block, + nBlocks int, + mode uint) sm.State { // run the whole chain against this client to build up the tendermint state - clientCreator := proxy.NewLocalClientCreator(kvstore.NewPersistentKVStoreApplication(filepath.Join(config.DBDir(), fmt.Sprintf("replay_test_%d_%d_t", nBlocks, mode)))) + clientCreator := proxy.NewLocalClientCreator( + kvstore.NewPersistentKVStoreApplication( + filepath.Join(config.DBDir(), fmt.Sprintf("replay_test_%d_%d_t", nBlocks, mode)))) proxyApp := proxy.NewAppConns(clientCreator) if err := proxyApp.Start(); err != nil { panic(err) @@ -853,7 +885,12 @@ func makeBlock(state sm.State, lastBlock *types.Block, lastBlockMeta *types.Bloc lastCommit := types.NewCommit(types.BlockID{}, nil) if height > 1 { - vote, _ := types.MakeVote(lastBlock.Header.Height, lastBlockMeta.BlockID, state.Validators, privVal, lastBlock.Header.ChainID) + vote, _ := types.MakeVote( + lastBlock.Header.Height, + lastBlockMeta.BlockID, + state.Validators, + privVal, + lastBlock.Header.ChainID) voteCommitSig := vote.CommitSig() lastCommit = types.NewCommit(lastBlockMeta.BlockID, []*types.CommitSig{voteCommitSig}) } @@ -994,7 +1031,10 @@ func readPieceFromWAL(msg *TimedWALMessage) interface{} { } // fresh state and mock store -func stateAndStore(config *cfg.Config, pubKey crypto.PubKey, appVersion version.Protocol) (dbm.DB, sm.State, *mockBlockStore) { +func stateAndStore( + config *cfg.Config, + pubKey crypto.PubKey, + appVersion version.Protocol) (dbm.DB, sm.State, *mockBlockStore) { stateDB := dbm.NewMemDB() state, _ := sm.MakeGenesisStateFromFile(config.GenesisFile()) state.Version.Consensus.App = appVersion diff --git a/consensus/state.go b/consensus/state.go index 50b5981e6..25dad26ce 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -425,7 +425,11 @@ func (cs *ConsensusState) AddProposalBlockPart(height int64, round int, part *ty } // SetProposalAndBlock inputs the proposal and all block parts. -func (cs *ConsensusState) SetProposalAndBlock(proposal *types.Proposal, block *types.Block, parts *types.PartSet, peerID p2p.ID) error { +func (cs *ConsensusState) SetProposalAndBlock( + proposal *types.Proposal, + block *types.Block, + parts *types.PartSet, + peerID p2p.ID) error { if err := cs.SetProposal(proposal, peerID); err != nil { return err } @@ -511,7 +515,12 @@ func (cs *ConsensusState) updateToState(state sm.State) { // signal the new round step, because other services (eg. txNotifier) // depend on having an up-to-date peer state! if !cs.state.IsEmpty() && (state.LastBlockHeight <= cs.state.LastBlockHeight) { - cs.Logger.Info("Ignoring updateToState()", "newHeight", state.LastBlockHeight+1, "oldHeight", cs.state.LastBlockHeight+1) + cs.Logger.Info( + "Ignoring updateToState()", + "newHeight", + state.LastBlockHeight+1, + "oldHeight", + cs.state.LastBlockHeight+1) cs.newStep() return } @@ -632,7 +641,10 @@ func (cs *ConsensusState) receiveRoutine(maxSteps int) { // may generate internal events (votes, complete proposals, 2/3 majorities) cs.handleMsg(mi) case mi = <-cs.internalMsgQueue: - cs.wal.WriteSync(mi) // NOTE: fsync + err := cs.wal.WriteSync(mi) // NOTE: fsync + if err != nil { + panic(fmt.Sprintf("Failed to write %v msg to consensus wal due to %v. Check your FS and restart the node", mi, err)) + } if _, ok := mi.Msg.(*VoteMessage); ok { // we actually want to simulate failing during @@ -679,7 +691,14 @@ func (cs *ConsensusState) handleMsg(mi msgInfo) { } if err != nil && msg.Round != cs.Round { - cs.Logger.Debug("Received block part from wrong round", "height", cs.Height, "csRound", cs.Round, "blockRound", msg.Round) + cs.Logger.Debug( + "Received block part from wrong round", + "height", + cs.Height, + "csRound", + cs.Round, + "blockRound", + msg.Round) err = nil } case *VoteMessage: @@ -791,7 +810,13 @@ func (cs *ConsensusState) enterNewRound(height int64, round int) { logger := cs.Logger.With("height", height, "round", round) if cs.Height != height || round < cs.Round || (cs.Round == round && cs.Step != cstypes.RoundStepNewHeight) { - logger.Debug(fmt.Sprintf("enterNewRound(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) + logger.Debug(fmt.Sprintf( + "enterNewRound(%v/%v): Invalid args. Current step: %v/%v/%v", + height, + round, + cs.Height, + cs.Round, + cs.Step)) return } @@ -855,13 +880,20 @@ func (cs *ConsensusState) needProofBlock(height int64) bool { } // Enter (CreateEmptyBlocks): from enterNewRound(height,round) -// Enter (CreateEmptyBlocks, CreateEmptyBlocksInterval > 0 ): after enterNewRound(height,round), after timeout of CreateEmptyBlocksInterval +// Enter (CreateEmptyBlocks, CreateEmptyBlocksInterval > 0 ): +// after enterNewRound(height,round), after timeout of CreateEmptyBlocksInterval // Enter (!CreateEmptyBlocks) : after enterNewRound(height,round), once txs are in the mempool func (cs *ConsensusState) enterPropose(height int64, round int) { logger := cs.Logger.With("height", height, "round", round) if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPropose <= cs.Step) { - logger.Debug(fmt.Sprintf("enterPropose(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) + logger.Debug(fmt.Sprintf( + "enterPropose(%v/%v): Invalid args. Current step: %v/%v/%v", + height, + round, + cs.Height, + cs.Round, + cs.Step)) return } logger.Info(fmt.Sprintf("enterPropose(%v/%v). Current: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) @@ -897,10 +929,18 @@ func (cs *ConsensusState) enterPropose(height int64, round int) { logger.Debug("This node is a validator") if cs.isProposer(address) { - logger.Info("enterPropose: Our turn to propose", "proposer", cs.Validators.GetProposer().Address, "privValidator", cs.privValidator) + logger.Info("enterPropose: Our turn to propose", + "proposer", + cs.Validators.GetProposer().Address, + "privValidator", + cs.privValidator) cs.decideProposal(height, round) } else { - logger.Info("enterPropose: Not our turn to propose", "proposer", cs.Validators.GetProposer().Address, "privValidator", cs.privValidator) + logger.Info("enterPropose: Not our turn to propose", + "proposer", + cs.Validators.GetProposer().Address, + "privValidator", + cs.privValidator) } } @@ -924,7 +964,8 @@ func (cs *ConsensusState) defaultDecideProposal(height int64, round int) { } } - // Flush the WAL. Otherwise, we may not recompute the same proposal to sign, and the privValidator will refuse to sign anything. + // Flush the WAL. Otherwise, we may not recompute the same proposal to sign, + // and the privValidator will refuse to sign anything. cs.wal.FlushAndSync() // Make proposal @@ -992,7 +1033,13 @@ func (cs *ConsensusState) createProposalBlock() (block *types.Block, blockParts // Otherwise vote nil. func (cs *ConsensusState) enterPrevote(height int64, round int) { if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrevote <= cs.Step) { - cs.Logger.Debug(fmt.Sprintf("enterPrevote(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) + cs.Logger.Debug(fmt.Sprintf( + "enterPrevote(%v/%v): Invalid args. Current step: %v/%v/%v", + height, + round, + cs.Height, + cs.Round, + cs.Step)) return } @@ -1049,7 +1096,13 @@ func (cs *ConsensusState) enterPrevoteWait(height int64, round int) { logger := cs.Logger.With("height", height, "round", round) if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrevoteWait <= cs.Step) { - logger.Debug(fmt.Sprintf("enterPrevoteWait(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) + logger.Debug(fmt.Sprintf( + "enterPrevoteWait(%v/%v): Invalid args. Current step: %v/%v/%v", + height, + round, + cs.Height, + cs.Round, + cs.Step)) return } if !cs.Votes.Prevotes(round).HasTwoThirdsAny() { @@ -1077,7 +1130,13 @@ func (cs *ConsensusState) enterPrecommit(height int64, round int) { logger := cs.Logger.With("height", height, "round", round) if cs.Height != height || round < cs.Round || (cs.Round == round && cstypes.RoundStepPrecommit <= cs.Step) { - logger.Debug(fmt.Sprintf("enterPrecommit(%v/%v): Invalid args. Current step: %v/%v/%v", height, round, cs.Height, cs.Round, cs.Step)) + logger.Debug(fmt.Sprintf( + "enterPrecommit(%v/%v): Invalid args. Current step: %v/%v/%v", + height, + round, + cs.Height, + cs.Round, + cs.Step)) return } @@ -1201,7 +1260,13 @@ func (cs *ConsensusState) enterCommit(height int64, commitRound int) { logger := cs.Logger.With("height", height, "commitRound", commitRound) if cs.Height != height || cstypes.RoundStepCommit <= cs.Step { - logger.Debug(fmt.Sprintf("enterCommit(%v/%v): Invalid args. Current step: %v/%v/%v", height, commitRound, cs.Height, cs.Round, cs.Step)) + logger.Debug(fmt.Sprintf( + "enterCommit(%v/%v): Invalid args. Current step: %v/%v/%v", + height, + commitRound, + cs.Height, + cs.Round, + cs.Step)) return } logger.Info(fmt.Sprintf("enterCommit(%v/%v). Current: %v/%v/%v", height, commitRound, cs.Height, cs.Round, cs.Step)) @@ -1235,7 +1300,12 @@ func (cs *ConsensusState) enterCommit(height int64, commitRound int) { // If we don't have the block being committed, set up to get it. if !cs.ProposalBlock.HashesTo(blockID.Hash) { if !cs.ProposalBlockParts.HasHeader(blockID.PartsHeader) { - logger.Info("Commit is for a block we don't know about. Set ProposalBlock=nil", "proposal", cs.ProposalBlock.Hash(), "commit", blockID.Hash) + logger.Info( + "Commit is for a block we don't know about. Set ProposalBlock=nil", + "proposal", + cs.ProposalBlock.Hash(), + "commit", + blockID.Hash) // We're getting the wrong block. // Set up ProposalBlockParts and keep waiting. cs.ProposalBlock = nil @@ -1265,7 +1335,12 @@ func (cs *ConsensusState) tryFinalizeCommit(height int64) { if !cs.ProposalBlock.HashesTo(blockID.Hash) { // TODO: this happens every time if we're not a validator (ugly logs) // TODO: ^^ wait, why does it matter that we're a validator? - logger.Info("Attempt to finalize failed. We don't have the commit block.", "proposal-block", cs.ProposalBlock.Hash(), "commit-block", blockID.Hash) + logger.Info( + "Attempt to finalize failed. We don't have the commit block.", + "proposal-block", + cs.ProposalBlock.Hash(), + "commit-block", + blockID.Hash) return } @@ -1276,7 +1351,12 @@ func (cs *ConsensusState) tryFinalizeCommit(height int64) { // Increment height and goto cstypes.RoundStepNewHeight func (cs *ConsensusState) finalizeCommit(height int64) { if cs.Height != height || cs.Step != cstypes.RoundStepCommit { - cs.Logger.Debug(fmt.Sprintf("finalizeCommit(%v): Invalid args. Current step: %v/%v/%v", height, cs.Height, cs.Round, cs.Step)) + cs.Logger.Debug(fmt.Sprintf( + "finalizeCommit(%v): Invalid args. Current step: %v/%v/%v", + height, + cs.Height, + cs.Round, + cs.Step)) return } @@ -1296,8 +1376,11 @@ func (cs *ConsensusState) finalizeCommit(height int64) { panic(fmt.Sprintf("+2/3 committed an invalid block: %v", err)) } - cs.Logger.Info(fmt.Sprintf("Finalizing commit of block with %d txs", block.NumTxs), - "height", block.Height, "hash", block.Hash(), "root", block.AppHash) + cs.Logger.Info("Finalizing commit of block with N txs", + "height", block.Height, + "hash", block.Hash(), + "root", block.AppHash, + "N", len(block.Txs)) cs.Logger.Info(fmt.Sprintf("%v", block)) fail.Fail() // XXX @@ -1329,7 +1412,10 @@ func (cs *ConsensusState) finalizeCommit(height int64) { // Either way, the ConsensusState should not be resumed until we // successfully call ApplyBlock (ie. later here, or in Handshake after // restart). - cs.wal.WriteSync(EndHeightMessage{height}) // NOTE: fsync + endMsg := EndHeightMessage{height} + if err := cs.wal.WriteSync(endMsg); err != nil { // NOTE: fsync + panic(fmt.Sprintf("Failed to write %v msg to consensus wal due to %v. Check your FS and restart the node", endMsg, err)) + } fail.Fail() // XXX @@ -1339,7 +1425,10 @@ func (cs *ConsensusState) finalizeCommit(height int64) { // Execute and commit the block, update and save the state, and update the mempool. // NOTE The block.AppHash wont reflect these txs until the next block. var err error - stateCopy, err = cs.blockExec.ApplyBlock(stateCopy, types.BlockID{Hash: block.Hash(), PartsHeader: blockParts.Header()}, block) + stateCopy, err = cs.blockExec.ApplyBlock( + stateCopy, + types.BlockID{Hash: block.Hash(), PartsHeader: blockParts.Header()}, + block) if err != nil { cs.Logger.Error("Error on ApplyBlock. Did the application crash? Please restart tendermint", "err", err) err := cmn.Kill() @@ -1402,11 +1491,10 @@ func (cs *ConsensusState) recordMetrics(height int64, block *types.Block) { ) } - cs.metrics.NumTxs.Set(float64(block.NumTxs)) + cs.metrics.NumTxs.Set(float64(len(block.Data.Txs))) + cs.metrics.TotalTxs.Add(float64(len(block.Data.Txs))) cs.metrics.BlockSizeBytes.Set(float64(block.Size())) - cs.metrics.TotalTxs.Set(float64(block.TotalTxs)) cs.metrics.CommittedHeight.Set(float64(block.Height)) - } //----------------------------------------------------------------------------- @@ -1446,7 +1534,8 @@ func (cs *ConsensusState) defaultSetProposal(proposal *types.Proposal) error { } // NOTE: block is not necessarily valid. -// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, once we have the full block. +// Asynchronously triggers either enterPrevote (before we timeout of propose) or tryFinalizeCommit, +// once we have the full block. func (cs *ConsensusState) addProposalBlockPart(msg *BlockPartMessage, peerID p2p.ID) (added bool, err error) { height, round, part := msg.Height, msg.Round, msg.Part @@ -1528,7 +1617,14 @@ func (cs *ConsensusState) tryAddVote(vote *types.Vote, peerID p2p.ID) (bool, err } else if voteErr, ok := err.(*types.ErrVoteConflictingVotes); ok { addr := cs.privValidator.GetPubKey().Address() if bytes.Equal(vote.ValidatorAddress, addr) { - cs.Logger.Error("Found conflicting vote from ourselves. Did you unsafe_reset a validator?", "height", vote.Height, "round", vote.Round, "type", vote.Type) + cs.Logger.Error( + "Found conflicting vote from ourselves. Did you unsafe_reset a validator?", + "height", + vote.Height, + "round", + vote.Round, + "type", + vote.Type) return added, err } cs.evpool.AddEvidence(voteErr.DuplicateVoteEvidence) @@ -1537,7 +1633,8 @@ func (cs *ConsensusState) tryAddVote(vote *types.Vote, peerID p2p.ID) (bool, err // Either // 1) bad peer OR // 2) not a bad peer? this can also err sometimes with "Unexpected step" OR - // 3) tmkms use with multiple validators connecting to a single tmkms instance (https://github.com/tendermint/tendermint/issues/3839). + // 3) tmkms use with multiple validators connecting to a single tmkms instance + // (https://github.com/tendermint/tendermint/issues/3839). cs.Logger.Info("Error attempting to add vote", "err", err) return added, ErrAddingVote } @@ -1547,8 +1644,19 @@ func (cs *ConsensusState) tryAddVote(vote *types.Vote, peerID p2p.ID) (bool, err //----------------------------------------------------------------------------- -func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool, err error) { - cs.Logger.Debug("addVote", "voteHeight", vote.Height, "voteType", vote.Type, "valIndex", vote.ValidatorIndex, "csHeight", cs.Height) +func (cs *ConsensusState) addVote( + vote *types.Vote, + peerID p2p.ID) (added bool, err error) { + cs.Logger.Debug( + "addVote", + "voteHeight", + vote.Height, + "voteType", + vote.Type, + "valIndex", + vote.ValidatorIndex, + "csHeight", + cs.Height) // A precommit for the previous height? // These come in while we wait timeoutCommit @@ -1694,8 +1802,12 @@ func (cs *ConsensusState) addVote(vote *types.Vote, peerID p2p.ID) (added bool, return added, err } -func (cs *ConsensusState) signVote(type_ types.SignedMsgType, hash []byte, header types.PartSetHeader) (*types.Vote, error) { - // Flush the WAL. Otherwise, we may not recompute the same vote to sign, and the privValidator will refuse to sign anything. +func (cs *ConsensusState) signVote( + type_ types.SignedMsgType, + hash []byte, + header types.PartSetHeader) (*types.Vote, error) { + // Flush the WAL. Otherwise, we may not recompute the same vote to sign, + // and the privValidator will refuse to sign anything. cs.wal.FlushAndSync() addr := cs.privValidator.GetPubKey().Address() diff --git a/consensus/state_test.go b/consensus/state_test.go index 96547e796..4de8d3734 100644 --- a/consensus/state_test.go +++ b/consensus/state_test.go @@ -107,7 +107,10 @@ func TestStateProposerSelection2(t *testing.T) { addr := vss[(i+round)%len(vss)].GetPubKey().Address() correctProposer := addr if !bytes.Equal(prop.Address, correctProposer) { - panic(fmt.Sprintf("expected RoundState.Validators.GetProposer() to be validator %d. Got %X", (i+2)%len(vss), prop.Address)) + panic(fmt.Sprintf( + "expected RoundState.Validators.GetProposer() to be validator %d. Got %X", + (i+2)%len(vss), + prop.Address)) } rs := cs1.GetRoundState() @@ -432,7 +435,10 @@ func TestStateLockNoPOL(t *testing.T) { // now we're on a new round and are the proposer if !bytes.Equal(rs.ProposalBlock.Hash(), rs.LockedBlock.Hash()) { - panic(fmt.Sprintf("Expected proposal block to be locked block. Got %v, Expected %v", rs.ProposalBlock, rs.LockedBlock)) + panic(fmt.Sprintf( + "Expected proposal block to be locked block. Got %v, Expected %v", + rs.ProposalBlock, + rs.LockedBlock)) } ensurePrevote(voteCh, height, round) // prevote @@ -446,7 +452,12 @@ func TestStateLockNoPOL(t *testing.T) { validatePrecommit(t, cs1, round, 0, vss[0], nil, theBlockHash) // precommit nil but be locked on proposal - signAddVotes(cs1, types.PrecommitType, hash, rs.ProposalBlock.MakePartSet(partSize).Header(), vs2) // NOTE: conflicting precommits at same height + signAddVotes( + cs1, + types.PrecommitType, + hash, + rs.ProposalBlock.MakePartSet(partSize).Header(), + vs2) // NOTE: conflicting precommits at same height ensurePrecommit(voteCh, height, round) ensureNewTimeout(timeoutWaitCh, height, round, cs1.config.Precommit(round).Nanoseconds()) @@ -486,7 +497,12 @@ func TestStateLockNoPOL(t *testing.T) { ensurePrecommit(voteCh, height, round) validatePrecommit(t, cs1, round, 0, vss[0], nil, theBlockHash) // precommit nil but locked on proposal - signAddVotes(cs1, types.PrecommitType, propBlock.Hash(), propBlock.MakePartSet(partSize).Header(), vs2) // NOTE: conflicting precommits at same height + signAddVotes( + cs1, + types.PrecommitType, + propBlock.Hash(), + propBlock.MakePartSet(partSize).Header(), + vs2) // NOTE: conflicting precommits at same height ensurePrecommit(voteCh, height, round) } @@ -1330,7 +1346,10 @@ func TestStartNextHeightCorrectly(t *testing.T) { ensureNewTimeout(timeoutProposeCh, height+1, round, cs1.config.Propose(round).Nanoseconds()) rs = cs1.GetRoundState() - assert.False(t, rs.TriggeredTimeoutPrecommit, "triggeredTimeoutPrecommit should be false at the beginning of each round") + assert.False( + t, + rs.TriggeredTimeoutPrecommit, + "triggeredTimeoutPrecommit should be false at the beginning of each round") } func TestResetTimeoutPrecommitUponNewHeight(t *testing.T) { @@ -1382,7 +1401,10 @@ func TestResetTimeoutPrecommitUponNewHeight(t *testing.T) { ensureNewProposal(proposalCh, height+1, 0) rs = cs1.GetRoundState() - assert.False(t, rs.TriggeredTimeoutPrecommit, "triggeredTimeoutPrecommit should be false at the beginning of each height") + assert.False( + t, + rs.TriggeredTimeoutPrecommit, + "triggeredTimeoutPrecommit should be false at the beginning of each height") } //------------------------------------------------------------------------------------------ diff --git a/consensus/types/height_vote_set.go b/consensus/types/height_vote_set.go index 35c9a486d..cc8a23f2f 100644 --- a/consensus/types/height_vote_set.go +++ b/consensus/types/height_vote_set.go @@ -16,7 +16,8 @@ type RoundVoteSet struct { } var ( - GotVoteFromUnwantedRoundError = errors.New("Peer has sent a vote that does not match our round for more than one round") + GotVoteFromUnwantedRoundError = errors.New( + "Peer has sent a vote that does not match our round for more than one round") ) /* @@ -176,7 +177,11 @@ func (hvs *HeightVoteSet) getVoteSet(round int, type_ types.SignedMsgType) *type // NOTE: if there are too many peers, or too much peer churn, // this can cause memory issues. // TODO: implement ability to remove peers too -func (hvs *HeightVoteSet) SetPeerMaj23(round int, type_ types.SignedMsgType, peerID p2p.ID, blockID types.BlockID) error { +func (hvs *HeightVoteSet) SetPeerMaj23( + round int, + type_ types.SignedMsgType, + peerID p2p.ID, + blockID types.BlockID) error { hvs.mtx.Lock() defer hvs.mtx.Unlock() if !types.IsVoteTypeValid(type_) { diff --git a/consensus/types/peer_round_state.go b/consensus/types/peer_round_state.go index 16e292940..2eae65f5a 100644 --- a/consensus/types/peer_round_state.go +++ b/consensus/types/peer_round_state.go @@ -13,21 +13,31 @@ import ( // PeerRoundState contains the known state of a peer. // NOTE: Read-only when returned by PeerState.GetRoundState(). type PeerRoundState struct { - Height int64 `json:"height"` // Height peer is at - Round int `json:"round"` // Round peer is at, -1 if unknown. - Step RoundStepType `json:"step"` // Step peer is at - StartTime time.Time `json:"start_time"` // Estimated start of round 0 at this height - Proposal bool `json:"proposal"` // True if peer has proposal for this round + Height int64 `json:"height"` // Height peer is at + Round int `json:"round"` // Round peer is at, -1 if unknown. + Step RoundStepType `json:"step"` // Step peer is at + + // Estimated start of round 0 at this height + StartTime time.Time `json:"start_time"` + + // True if peer has proposal for this round + Proposal bool `json:"proposal"` ProposalBlockPartsHeader types.PartSetHeader `json:"proposal_block_parts_header"` // ProposalBlockParts *cmn.BitArray `json:"proposal_block_parts"` // ProposalPOLRound int `json:"proposal_pol_round"` // Proposal's POL round. -1 if none. - ProposalPOL *cmn.BitArray `json:"proposal_pol"` // nil until ProposalPOLMessage received. - Prevotes *cmn.BitArray `json:"prevotes"` // All votes peer has for this round - Precommits *cmn.BitArray `json:"precommits"` // All precommits peer has for this round - LastCommitRound int `json:"last_commit_round"` // Round of commit for last height. -1 if none. - LastCommit *cmn.BitArray `json:"last_commit"` // All commit precommits of commit for last height. - CatchupCommitRound int `json:"catchup_commit_round"` // Round that we have commit for. Not necessarily unique. -1 if none. - CatchupCommit *cmn.BitArray `json:"catchup_commit"` // All commit precommits peer has for this height & CatchupCommitRound + + // nil until ProposalPOLMessage received. + ProposalPOL *cmn.BitArray `json:"proposal_pol"` + Prevotes *cmn.BitArray `json:"prevotes"` // All votes peer has for this round + Precommits *cmn.BitArray `json:"precommits"` // All precommits peer has for this round + LastCommitRound int `json:"last_commit_round"` // Round of commit for last height. -1 if none. + LastCommit *cmn.BitArray `json:"last_commit"` // All commit precommits of commit for last height. + + // Round that we have commit for. Not necessarily unique. -1 if none. + CatchupCommitRound int `json:"catchup_commit_round"` + + // All commit precommits peer has for this height & CatchupCommitRound + CatchupCommit *cmn.BitArray `json:"catchup_commit"` } // String returns a string representation of the PeerRoundState diff --git a/consensus/types/round_state.go b/consensus/types/round_state.go index c4372e201..47c3f1fd7 100644 --- a/consensus/types/round_state.go +++ b/consensus/types/round_state.go @@ -65,21 +65,27 @@ func (rs RoundStepType) String() string { // NOTE: Not thread safe. Should only be manipulated by functions downstream // of the cs.receiveRoutine type RoundState struct { - Height int64 `json:"height"` // Height we are working on - Round int `json:"round"` - Step RoundStepType `json:"step"` - StartTime time.Time `json:"start_time"` - CommitTime time.Time `json:"commit_time"` // Subjective time when +2/3 precommits for Block at Round were found - Validators *types.ValidatorSet `json:"validators"` - Proposal *types.Proposal `json:"proposal"` - ProposalBlock *types.Block `json:"proposal_block"` - ProposalBlockParts *types.PartSet `json:"proposal_block_parts"` - LockedRound int `json:"locked_round"` - LockedBlock *types.Block `json:"locked_block"` - LockedBlockParts *types.PartSet `json:"locked_block_parts"` - ValidRound int `json:"valid_round"` // Last known round with POL for non-nil valid block. - ValidBlock *types.Block `json:"valid_block"` // Last known block of POL mentioned above. - ValidBlockParts *types.PartSet `json:"valid_block_parts"` // Last known block parts of POL metnioned above. + Height int64 `json:"height"` // Height we are working on + Round int `json:"round"` + Step RoundStepType `json:"step"` + StartTime time.Time `json:"start_time"` + + // Subjective time when +2/3 precommits for Block at Round were found + CommitTime time.Time `json:"commit_time"` + Validators *types.ValidatorSet `json:"validators"` + Proposal *types.Proposal `json:"proposal"` + ProposalBlock *types.Block `json:"proposal_block"` + ProposalBlockParts *types.PartSet `json:"proposal_block_parts"` + LockedRound int `json:"locked_round"` + LockedBlock *types.Block `json:"locked_block"` + LockedBlockParts *types.PartSet `json:"locked_block_parts"` + + // Last known round with POL for non-nil valid block. + ValidRound int `json:"valid_round"` + ValidBlock *types.Block `json:"valid_block"` // Last known block of POL mentioned above. + + // Last known block parts of POL metnioned above. + ValidBlockParts *types.PartSet `json:"valid_block_parts"` Votes *HeightVoteSet `json:"votes"` CommitRound int `json:"commit_round"` // LastCommit *types.VoteSet `json:"last_commit"` // Last precommits at Height-1 diff --git a/consensus/wal.go b/consensus/wal.go index c63c6b940..166c95d9e 100644 --- a/consensus/wal.go +++ b/consensus/wal.go @@ -19,8 +19,9 @@ import ( ) const ( - // must be greater than types.BlockPartSizeBytes + a few bytes - maxMsgSizeBytes = 1024 * 1024 // 1MB + // amino overhead + time.Time + max consensus msg size + // TODO: Can we clarify better where 24 comes from precisely? + maxMsgSizeBytes = maxMsgSize + 24 // how often the WAL should be sync'd during period sync'ing walDefaultFlushInterval = 2 * time.Second @@ -29,8 +30,9 @@ const ( //-------------------------------------------------------- // types and functions for savings consensus messages +// TimedWALMessage wraps WALMessage and adds Time for debugging purposes. type TimedWALMessage struct { - Time time.Time `json:"time"` // for debugging purposes + Time time.Time `json:"time"` Msg WALMessage `json:"msg"` } @@ -55,8 +57,8 @@ func RegisterWALMessages(cdc *amino.Codec) { // WAL is an interface for any write-ahead logger. type WAL interface { - Write(WALMessage) - WriteSync(WALMessage) + Write(WALMessage) error + WriteSync(WALMessage) error FlushAndSync() error SearchForEndHeight(height int64, options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) @@ -174,29 +176,39 @@ func (wal *baseWAL) Wait() { // Write is called in newStep and for each receive on the // peerMsgQueue and the timeoutTicker. // NOTE: does not call fsync() -func (wal *baseWAL) Write(msg WALMessage) { +func (wal *baseWAL) Write(msg WALMessage) error { if wal == nil { - return + return nil } - // Write the wal message if err := wal.enc.Encode(&TimedWALMessage{tmtime.Now(), msg}); err != nil { - panic(fmt.Sprintf("Error writing msg to consensus wal: %v \n\nMessage: %v", err, msg)) + wal.Logger.Error("Error writing msg to consensus wal. WARNING: recover may not be possible for the current height", + "err", err, "msg", msg) + return err } + + return nil } // WriteSync is called when we receive a msg from ourselves // so that we write to disk before sending signed messages. // NOTE: calls fsync() -func (wal *baseWAL) WriteSync(msg WALMessage) { +func (wal *baseWAL) WriteSync(msg WALMessage) error { if wal == nil { - return + return nil } - wal.Write(msg) - if err := wal.FlushAndSync(); err != nil { - panic(fmt.Sprintf("Error flushing consensus wal buf to file. Error: %v \n", err)) + if err := wal.Write(msg); err != nil { + return err } + + if err := wal.FlushAndSync(); err != nil { + wal.Logger.Error("WriteSync failed to flush consensus wal. WARNING: may result in creating alternative proposals / votes for the current height iff the node restarted", + "err", err) + return err + } + + return nil } // WALSearchOptions are optional arguments to SearchForEndHeight. @@ -210,7 +222,9 @@ type WALSearchOptions struct { // Group reader will be nil if found equals false. // // CONTRACT: caller must close group reader. -func (wal *baseWAL) SearchForEndHeight(height int64, options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { +func (wal *baseWAL) SearchForEndHeight( + height int64, + options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { var ( msg *TimedWALMessage gr *auto.GroupReader @@ -285,7 +299,7 @@ func (enc *WALEncoder) Encode(v *TimedWALMessage) error { crc := crc32.Checksum(data, crc32c) length := uint32(len(data)) if length > maxMsgSizeBytes { - return fmt.Errorf("Msg is too big: %d bytes, max: %d bytes", length, maxMsgSizeBytes) + return fmt.Errorf("msg is too big: %d bytes, max: %d bytes", length, maxMsgSizeBytes) } totalLength := 8 + int(length) @@ -295,7 +309,6 @@ func (enc *WALEncoder) Encode(v *TimedWALMessage) error { copy(msg[8:], data) _, err := enc.wr.Write(msg) - return err } @@ -355,7 +368,10 @@ func (dec *WALDecoder) Decode() (*TimedWALMessage, error) { length := binary.BigEndian.Uint32(b) if length > maxMsgSizeBytes { - return nil, DataCorruptionError{fmt.Errorf("length %d exceeded maximum possible value of %d bytes", length, maxMsgSizeBytes)} + return nil, DataCorruptionError{fmt.Errorf( + "length %d exceeded maximum possible value of %d bytes", + length, + maxMsgSizeBytes)} } data := make([]byte, length) @@ -383,9 +399,9 @@ type nilWAL struct{} var _ WAL = nilWAL{} -func (nilWAL) Write(m WALMessage) {} -func (nilWAL) WriteSync(m WALMessage) {} -func (nilWAL) FlushAndSync() error { return nil } +func (nilWAL) Write(m WALMessage) error { return nil } +func (nilWAL) WriteSync(m WALMessage) error { return nil } +func (nilWAL) FlushAndSync() error { return nil } func (nilWAL) SearchForEndHeight(height int64, options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { return nil, false, nil } diff --git a/consensus/wal_generator.go b/consensus/wal_generator.go index 8b5bbc2f0..6ceeb19b6 100644 --- a/consensus/wal_generator.go +++ b/consensus/wal_generator.go @@ -27,7 +27,8 @@ import ( // WALGenerateNBlocks generates a consensus WAL. It does this by spinning up a // stripped down version of node (proxy app, event bus, consensus state) with a // persistent kvstore application and special consensus wal instance -// (byteBufferWAL) and waits until numBlocks are created. If the node fails to produce given numBlocks, it returns an error. +// (byteBufferWAL) and waits until numBlocks are created. +// If the node fails to produce given numBlocks, it returns an error. func WALGenerateNBlocks(t *testing.T, wr io.Writer, numBlocks int) (err error) { config := getConfig(t) @@ -168,10 +169,10 @@ func newByteBufferWAL(logger log.Logger, enc *WALEncoder, nBlocks int64, signalS // Save writes message to the internal buffer except when heightToStop is // reached, in which case it will signal the caller via signalWhenStopsTo and // skip writing. -func (w *byteBufferWAL) Write(m WALMessage) { +func (w *byteBufferWAL) Write(m WALMessage) error { if w.stopped { w.logger.Debug("WAL already stopped. Not writing message", "msg", m) - return + return nil } if endMsg, ok := m.(EndHeightMessage); ok { @@ -180,7 +181,7 @@ func (w *byteBufferWAL) Write(m WALMessage) { w.logger.Debug("Stopping WAL at height", "height", endMsg.Height) w.signalWhenStopsTo <- struct{}{} w.stopped = true - return + return nil } } @@ -189,15 +190,19 @@ func (w *byteBufferWAL) Write(m WALMessage) { if err != nil { panic(fmt.Sprintf("failed to encode the msg %v", m)) } + + return nil } -func (w *byteBufferWAL) WriteSync(m WALMessage) { - w.Write(m) +func (w *byteBufferWAL) WriteSync(m WALMessage) error { + return w.Write(m) } func (w *byteBufferWAL) FlushAndSync() error { return nil } -func (w *byteBufferWAL) SearchForEndHeight(height int64, options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { +func (w *byteBufferWAL) SearchForEndHeight( + height int64, + options *WALSearchOptions) (rd io.ReadCloser, found bool, err error) { return nil, false, nil } diff --git a/consensus/wal_test.go b/consensus/wal_test.go index 82d912f3a..6871f534d 100644 --- a/consensus/wal_test.go +++ b/consensus/wal_test.go @@ -11,14 +11,15 @@ import ( "testing" "time" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "github.com/tendermint/tendermint/consensus/types" + "github.com/tendermint/tendermint/crypto/merkle" "github.com/tendermint/tendermint/libs/autofile" "github.com/tendermint/tendermint/libs/log" tmtypes "github.com/tendermint/tendermint/types" tmtime "github.com/tendermint/tendermint/types/time" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" ) const ( @@ -103,7 +104,7 @@ func TestWALEncoderDecoder(t *testing.T) { } } -func TestWALWritePanicsIfMsgIsTooBig(t *testing.T) { +func TestWALWrite(t *testing.T) { walDir, err := ioutil.TempDir("", "wal") require.NoError(t, err) defer os.RemoveAll(walDir) @@ -120,7 +121,24 @@ func TestWALWritePanicsIfMsgIsTooBig(t *testing.T) { wal.Wait() }() - assert.Panics(t, func() { wal.Write(make([]byte, maxMsgSizeBytes+1)) }) + // 1) Write returns an error if msg is too big + msg := &BlockPartMessage{ + Height: 1, + Round: 1, + Part: &tmtypes.Part{ + Index: 1, + Bytes: make([]byte, 1), + Proof: merkle.SimpleProof{ + Total: 1, + Index: 1, + LeafHash: make([]byte, maxMsgSizeBytes-30), + }, + }, + } + err = wal.Write(msg) + if assert.Error(t, err) { + assert.Contains(t, err.Error(), "msg is too big") + } } func TestWALSearchForEndHeight(t *testing.T) { diff --git a/crypto/README.md b/crypto/README.md index bb6631227..a77a7ab6c 100644 --- a/crypto/README.md +++ b/crypto/README.md @@ -14,7 +14,7 @@ If you want to decode bytes into one of the types, but don't care about the spec ## Binary encoding -For Binary encoding, please refer to the [Tendermint encoding spec](https://github.com/tendermint/tendermint/blob/master/docs/spec/blockchain/encoding.md). +For Binary encoding, please refer to the [Tendermint encoding specification](https://github.com/tendermint/tendermint/blob/master/docs/spec/blockchain/encoding.md). ## JSON Encoding diff --git a/crypto/encoding/amino/amino.go b/crypto/encoding/amino/amino.go index f7be3a203..1aed88115 100644 --- a/crypto/encoding/amino/amino.go +++ b/crypto/encoding/amino/amino.go @@ -60,11 +60,19 @@ func RegisterAmino(cdc *amino.Codec) { secp256k1.PrivKeyAminoName, nil) } +// RegisterKeyType registers an external key type to allow decoding it from bytes +func RegisterKeyType(o interface{}, name string) { + cdc.RegisterConcrete(o, name, nil) + nameTable[reflect.TypeOf(o)] = name +} + +// PrivKeyFromBytes unmarshals private key bytes and returns a PrivKey func PrivKeyFromBytes(privKeyBytes []byte) (privKey crypto.PrivKey, err error) { err = cdc.UnmarshalBinaryBare(privKeyBytes, &privKey) return } +// PubKeyFromBytes unmarshals public key bytes and returns a PubKey func PubKeyFromBytes(pubKeyBytes []byte) (pubKey crypto.PubKey, err error) { err = cdc.UnmarshalBinaryBare(pubKeyBytes, &pubKey) return diff --git a/crypto/encoding/amino/encode_test.go b/crypto/encoding/amino/encode_test.go index d4e349454..e73478b54 100644 --- a/crypto/encoding/amino/encode_test.go +++ b/crypto/encoding/amino/encode_test.go @@ -2,10 +2,13 @@ package cryptoAmino import ( "os" + "reflect" "testing" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" + + amino "github.com/tendermint/go-amino" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/crypto/ed25519" "github.com/tendermint/tendermint/crypto/multisig" @@ -147,3 +150,75 @@ func TestPubkeyAminoName(t *testing.T) { } } } + +var _ crypto.PrivKey = testPriv{} +var _ crypto.PubKey = testPub{} +var testCdc = amino.NewCodec() + +type testPriv []byte + +func (privkey testPriv) PubKey() crypto.PubKey { return testPub{} } +func (privkey testPriv) Bytes() []byte { + return testCdc.MustMarshalBinaryBare(privkey) +} +func (privkey testPriv) Sign(msg []byte) ([]byte, error) { return []byte{}, nil } +func (privkey testPriv) Equals(other crypto.PrivKey) bool { return true } + +type testPub []byte + +func (key testPub) Address() crypto.Address { return crypto.Address{} } +func (key testPub) Bytes() []byte { + return testCdc.MustMarshalBinaryBare(key) +} +func (key testPub) VerifyBytes(msg []byte, sig []byte) bool { return true } +func (key testPub) Equals(other crypto.PubKey) bool { return true } + +var ( + privAminoName = "registerTest/Priv" + pubAminoName = "registerTest/Pub" +) + +func TestRegisterKeyType(t *testing.T) { + RegisterAmino(testCdc) + testCdc.RegisterConcrete(testPriv{}, privAminoName, nil) + testCdc.RegisterConcrete(testPub{}, pubAminoName, nil) + + pub := testPub{0x1} + priv := testPriv{0x2} + + // Check to make sure key cannot be decoded before registering + _, err := PrivKeyFromBytes(priv.Bytes()) + require.Error(t, err) + _, err = PubKeyFromBytes(pub.Bytes()) + require.Error(t, err) + + // Check that name is not registered + _, found := PubkeyAminoName(testCdc, pub) + require.False(t, found) + + // Register key types + RegisterKeyType(testPriv{}, privAminoName) + RegisterKeyType(testPub{}, pubAminoName) + + // Name should exist after registering + name, found := PubkeyAminoName(testCdc, pub) + require.True(t, found) + require.Equal(t, name, pubAminoName) + + // Decode keys using the encoded bytes from encoding with the other codec + decodedPriv, err := PrivKeyFromBytes(priv.Bytes()) + require.NoError(t, err) + require.Equal(t, priv, decodedPriv) + + decodedPub, err := PubKeyFromBytes(pub.Bytes()) + require.NoError(t, err) + require.Equal(t, pub, decodedPub) + + // Reset module codec after testing + cdc = amino.NewCodec() + nameTable = make(map[reflect.Type]string, 3) + RegisterAmino(cdc) + nameTable[reflect.TypeOf(ed25519.PubKeyEd25519{})] = ed25519.PubKeyAminoName + nameTable[reflect.TypeOf(secp256k1.PubKeySecp256k1{})] = secp256k1.PubKeyAminoName + nameTable[reflect.TypeOf(multisig.PubKeyMultisigThreshold{})] = multisig.PubKeyMultisigThresholdAminoRoute +} diff --git a/crypto/merkle/merkle.pb.go b/crypto/merkle/merkle.pb.go index 5b7e15c5a..2ebbee155 100644 --- a/crypto/merkle/merkle.pb.go +++ b/crypto/merkle/merkle.pb.go @@ -3,14 +3,15 @@ package merkle -import proto "github.com/gogo/protobuf/proto" -import fmt "fmt" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import bytes "bytes" - -import io "io" +import ( + bytes "bytes" + fmt "fmt" + _ "github.com/gogo/protobuf/gogoproto" + proto "github.com/gogo/protobuf/proto" + io "io" + math "math" + math_bits "math/bits" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -21,7 +22,7 @@ var _ = math.Inf // is compatible with the proto package it is being compiled against. // A compilation error at this line likely means your copy of the // proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // ProofOp defines an operation used for calculating Merkle root // The data could be arbitrary format, providing nessecary data @@ -39,7 +40,7 @@ func (m *ProofOp) Reset() { *m = ProofOp{} } func (m *ProofOp) String() string { return proto.CompactTextString(m) } func (*ProofOp) ProtoMessage() {} func (*ProofOp) Descriptor() ([]byte, []int) { - return fileDescriptor_merkle_24be8bc4e405ac66, []int{0} + return fileDescriptor_9c1c2162d560d38e, []int{0} } func (m *ProofOp) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -49,15 +50,15 @@ func (m *ProofOp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_ProofOp.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *ProofOp) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProofOp.Merge(dst, src) +func (m *ProofOp) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProofOp.Merge(m, src) } func (m *ProofOp) XXX_Size() int { return m.Size() @@ -91,7 +92,7 @@ func (m *ProofOp) GetData() []byte { // Proof is Merkle proof defined by the list of ProofOps type Proof struct { - Ops []ProofOp `protobuf:"bytes,1,rep,name=ops" json:"ops"` + Ops []ProofOp `protobuf:"bytes,1,rep,name=ops,proto3" json:"ops"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` @@ -101,7 +102,7 @@ func (m *Proof) Reset() { *m = Proof{} } func (m *Proof) String() string { return proto.CompactTextString(m) } func (*Proof) ProtoMessage() {} func (*Proof) Descriptor() ([]byte, []int) { - return fileDescriptor_merkle_24be8bc4e405ac66, []int{1} + return fileDescriptor_9c1c2162d560d38e, []int{1} } func (m *Proof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -111,15 +112,15 @@ func (m *Proof) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Proof.Marshal(b, m, deterministic) } else { b = b[:cap(b)] - n, err := m.MarshalTo(b) + n, err := m.MarshalToSizedBuffer(b) if err != nil { return nil, err } return b[:n], nil } } -func (dst *Proof) XXX_Merge(src proto.Message) { - xxx_messageInfo_Proof.Merge(dst, src) +func (m *Proof) XXX_Merge(src proto.Message) { + xxx_messageInfo_Proof.Merge(m, src) } func (m *Proof) XXX_Size() int { return m.Size() @@ -141,6 +142,26 @@ func init() { proto.RegisterType((*ProofOp)(nil), "merkle.ProofOp") proto.RegisterType((*Proof)(nil), "merkle.Proof") } + +func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_9c1c2162d560d38e) } + +var fileDescriptor_9c1c2162d560d38e = []byte{ + // 200 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c, + 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, + 0xf9, 0x42, 0x6c, 0x10, 0x9e, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, + 0xae, 0x7e, 0x7a, 0x7e, 0x7a, 0xbe, 0x3e, 0x58, 0x3a, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, + 0x2c, 0x88, 0x36, 0x25, 0x67, 0x2e, 0xf6, 0x80, 0xa2, 0xfc, 0xfc, 0x34, 0xff, 0x02, 0x21, 0x21, + 0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x30, 0x5b, 0x48, + 0x80, 0x8b, 0x39, 0x3b, 0xb5, 0x52, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc4, 0x04, 0xa9, + 0x4a, 0x49, 0x2c, 0x49, 0x94, 0x60, 0x06, 0x0b, 0x81, 0xd9, 0x4a, 0x06, 0x5c, 0xac, 0x60, 0x43, + 0x84, 0xd4, 0xb9, 0x98, 0xf3, 0x0b, 0x8a, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0xf8, 0xf5, + 0xa0, 0x0e, 0x84, 0x5a, 0xe0, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x85, 0x93, 0xc8, + 0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, + 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60, 0x37, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, + 0xb9, 0x2b, 0x0f, 0xd1, 0xe8, 0x00, 0x00, 0x00, +} + func (this *ProofOp) Equal(that interface{}) bool { if that == nil { return this == nil @@ -209,7 +230,7 @@ func (this *Proof) Equal(that interface{}) bool { func (m *ProofOp) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -217,38 +238,47 @@ func (m *ProofOp) Marshal() (dAtA []byte, err error) { } func (m *ProofOp) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l - if len(m.Type) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type))) - i += copy(dAtA[i:], m.Type) - } - if len(m.Key) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key))) - i += copy(dAtA[i:], m.Key) + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) } if len(m.Data) > 0 { - dAtA[i] = 0x1a - i++ + i -= len(m.Data) + copy(dAtA[i:], m.Data) i = encodeVarintMerkle(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) + i-- + dAtA[i] = 0x1a } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) + if len(m.Key) > 0 { + i -= len(m.Key) + copy(dAtA[i:], m.Key) + i = encodeVarintMerkle(dAtA, i, uint64(len(m.Key))) + i-- + dAtA[i] = 0x12 } - return i, nil + if len(m.Type) > 0 { + i -= len(m.Type) + copy(dAtA[i:], m.Type) + i = encodeVarintMerkle(dAtA, i, uint64(len(m.Type))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil } func (m *Proof) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) - n, err := m.MarshalTo(dAtA) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) if err != nil { return nil, err } @@ -256,36 +286,46 @@ func (m *Proof) Marshal() (dAtA []byte, err error) { } func (m *Proof) MarshalTo(dAtA []byte) (int, error) { - var i int + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) _ = i var l int _ = l + if m.XXX_unrecognized != nil { + i -= len(m.XXX_unrecognized) + copy(dAtA[i:], m.XXX_unrecognized) + } if len(m.Ops) > 0 { - for _, msg := range m.Ops { - dAtA[i] = 0xa - i++ - i = encodeVarintMerkle(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err + for iNdEx := len(m.Ops) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Ops[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMerkle(dAtA, i, uint64(size)) } - i += n + i-- + dAtA[i] = 0xa } } - if m.XXX_unrecognized != nil { - i += copy(dAtA[i:], m.XXX_unrecognized) - } - return i, nil + return len(dAtA) - i, nil } func encodeVarintMerkle(dAtA []byte, offset int, v uint64) int { + offset -= sovMerkle(v) + base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) v >>= 7 offset++ } dAtA[offset] = uint8(v) - return offset + 1 + return base } func NewPopulatedProofOp(r randyMerkle, easy bool) *ProofOp { this := &ProofOp{} @@ -308,7 +348,7 @@ func NewPopulatedProofOp(r randyMerkle, easy bool) *ProofOp { func NewPopulatedProof(r randyMerkle, easy bool) *Proof { this := &Proof{} - if r.Intn(10) != 0 { + if r.Intn(5) != 0 { v3 := r.Intn(5) this.Ops = make([]ProofOp, v3) for i := 0; i < v3; i++ { @@ -437,14 +477,7 @@ func (m *Proof) Size() (n int) { } func sovMerkle(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n + return (math_bits.Len64(x|1) + 6) / 7 } func sozMerkle(x uint64) (n int) { return sovMerkle(uint64((x << 1) ^ uint64((int64(x) >> 63)))) @@ -464,7 +497,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -492,7 +525,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= (uint64(b) & 0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -502,6 +535,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -521,7 +557,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -530,6 +566,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -552,7 +591,7 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + byteLen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -561,6 +600,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -578,6 +620,9 @@ func (m *ProofOp) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMerkle } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMerkle + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -606,7 +651,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - wire |= (uint64(b) & 0x7F) << shift + wire |= uint64(b&0x7F) << shift if b < 0x80 { break } @@ -634,7 +679,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= (int(b) & 0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } @@ -643,6 +688,9 @@ func (m *Proof) Unmarshal(dAtA []byte) error { return ErrInvalidLengthMerkle } postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMerkle + } if postIndex > l { return io.ErrUnexpectedEOF } @@ -660,6 +708,9 @@ func (m *Proof) Unmarshal(dAtA []byte) error { if skippy < 0 { return ErrInvalidLengthMerkle } + if (iNdEx + skippy) < 0 { + return ErrInvalidLengthMerkle + } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF } @@ -727,10 +778,13 @@ func skipMerkle(dAtA []byte) (n int, err error) { break } } - iNdEx += length if length < 0 { return 0, ErrInvalidLengthMerkle } + iNdEx += length + if iNdEx < 0 { + return 0, ErrInvalidLengthMerkle + } return iNdEx, nil case 3: for { @@ -759,6 +813,9 @@ func skipMerkle(dAtA []byte) (n int, err error) { return 0, err } iNdEx = start + next + if iNdEx < 0 { + return 0, ErrInvalidLengthMerkle + } } return iNdEx, nil case 4: @@ -777,22 +834,3 @@ var ( ErrInvalidLengthMerkle = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowMerkle = fmt.Errorf("proto: integer overflow") ) - -func init() { proto.RegisterFile("crypto/merkle/merkle.proto", fileDescriptor_merkle_24be8bc4e405ac66) } - -var fileDescriptor_merkle_24be8bc4e405ac66 = []byte{ - // 200 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4a, 0x2e, 0xaa, 0x2c, - 0x28, 0xc9, 0xd7, 0xcf, 0x4d, 0x2d, 0xca, 0xce, 0x49, 0x85, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, - 0xf9, 0x42, 0x6c, 0x10, 0x9e, 0x94, 0x6e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, - 0xae, 0x7e, 0x7a, 0x7e, 0x7a, 0xbe, 0x3e, 0x58, 0x3a, 0xa9, 0x34, 0x0d, 0xcc, 0x03, 0x73, 0xc0, - 0x2c, 0x88, 0x36, 0x25, 0x67, 0x2e, 0xf6, 0x80, 0xa2, 0xfc, 0xfc, 0x34, 0xff, 0x02, 0x21, 0x21, - 0x2e, 0x96, 0x92, 0xca, 0x82, 0x54, 0x09, 0x46, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x30, 0x5b, 0x48, - 0x80, 0x8b, 0x39, 0x3b, 0xb5, 0x52, 0x82, 0x49, 0x81, 0x51, 0x83, 0x27, 0x08, 0xc4, 0x04, 0xa9, - 0x4a, 0x49, 0x2c, 0x49, 0x94, 0x60, 0x06, 0x0b, 0x81, 0xd9, 0x4a, 0x06, 0x5c, 0xac, 0x60, 0x43, - 0x84, 0xd4, 0xb9, 0x98, 0xf3, 0x0b, 0x8a, 0x25, 0x18, 0x15, 0x98, 0x35, 0xb8, 0x8d, 0xf8, 0xf5, - 0xa0, 0x0e, 0x84, 0x5a, 0xe0, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x48, 0x85, 0x93, 0xc8, - 0x8f, 0x87, 0x72, 0x8c, 0x2b, 0x1e, 0xc9, 0x31, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x49, 0x6c, 0x60, 0x37, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, - 0xb9, 0x2b, 0x0f, 0xd1, 0xe8, 0x00, 0x00, 0x00, -} diff --git a/crypto/merkle/simple_map_test.go b/crypto/merkle/simple_map_test.go index 366d9f390..20868a782 100644 --- a/crypto/merkle/simple_map_test.go +++ b/crypto/merkle/simple_map_test.go @@ -16,11 +16,27 @@ func TestSimpleMap(t *testing.T) { {[]string{"key1"}, []string{"value1"}, "a44d3cc7daba1a4600b00a2434b30f8b970652169810d6dfa9fb1793a2189324"}, {[]string{"key1"}, []string{"value2"}, "0638e99b3445caec9d95c05e1a3fc1487b4ddec6a952ff337080360b0dcc078c"}, // swap order with 2 keys - {[]string{"key1", "key2"}, []string{"value1", "value2"}, "8fd19b19e7bb3f2b3ee0574027d8a5a4cec370464ea2db2fbfa5c7d35bb0cff3"}, - {[]string{"key2", "key1"}, []string{"value2", "value1"}, "8fd19b19e7bb3f2b3ee0574027d8a5a4cec370464ea2db2fbfa5c7d35bb0cff3"}, + { + []string{"key1", "key2"}, + []string{"value1", "value2"}, + "8fd19b19e7bb3f2b3ee0574027d8a5a4cec370464ea2db2fbfa5c7d35bb0cff3", + }, + { + []string{"key2", "key1"}, + []string{"value2", "value1"}, + "8fd19b19e7bb3f2b3ee0574027d8a5a4cec370464ea2db2fbfa5c7d35bb0cff3", + }, // swap order with 3 keys - {[]string{"key1", "key2", "key3"}, []string{"value1", "value2", "value3"}, "1dd674ec6782a0d586a903c9c63326a41cbe56b3bba33ed6ff5b527af6efb3dc"}, - {[]string{"key1", "key3", "key2"}, []string{"value1", "value3", "value2"}, "1dd674ec6782a0d586a903c9c63326a41cbe56b3bba33ed6ff5b527af6efb3dc"}, + { + []string{"key1", "key2", "key3"}, + []string{"value1", "value2", "value3"}, + "1dd674ec6782a0d586a903c9c63326a41cbe56b3bba33ed6ff5b527af6efb3dc", + }, + { + []string{"key1", "key3", "key2"}, + []string{"value1", "value3", "value2"}, + "1dd674ec6782a0d586a903c9c63326a41cbe56b3bba33ed6ff5b527af6efb3dc", + }, } for i, tc := range tests { db := newSimpleMap() diff --git a/crypto/merkle/simple_proof.go b/crypto/merkle/simple_proof.go index da32157db..79a4729eb 100644 --- a/crypto/merkle/simple_proof.go +++ b/crypto/merkle/simple_proof.go @@ -5,6 +5,14 @@ import ( "fmt" "github.com/pkg/errors" + "github.com/tendermint/tendermint/crypto/tmhash" +) + +const ( + // MaxAunts is the maximum number of aunts that can be included in a SimpleProof. + // This corresponds to a tree of size 2^100, which should be sufficient for all conceivable purposes. + // This maximum helps prevent Denial-of-Service attacks by limitting the size of the proofs. + MaxAunts = 100 ) // SimpleProof represents a simple Merkle proof. @@ -108,6 +116,30 @@ func (sp *SimpleProof) StringIndented(indent string) string { indent) } +// ValidateBasic performs basic validation. +// NOTE: it expects the LeafHash and the elements of Aunts to be of size tmhash.Size, +// and it expects at most MaxAunts elements in Aunts. +func (sp *SimpleProof) ValidateBasic() error { + if sp.Total < 0 { + return errors.New("negative Total") + } + if sp.Index < 0 { + return errors.New("negative Index") + } + if len(sp.LeafHash) != tmhash.Size { + return errors.Errorf("expected LeafHash size to be %d, got %d", tmhash.Size, len(sp.LeafHash)) + } + if len(sp.Aunts) > MaxAunts { + return errors.Errorf("expected no more than %d aunts, got %d", MaxAunts, len(sp.Aunts)) + } + for i, auntHash := range sp.Aunts { + if len(auntHash) != tmhash.Size { + return errors.Errorf("expected Aunts#%d size to be %d, got %d", i, tmhash.Size, len(auntHash)) + } + } + return nil +} + // Use the leafHash and innerHashes to get the root merkle hash. // If the length of the innerHashes slice isn't exactly correct, the result is nil. // Recursive impl. diff --git a/crypto/merkle/simple_proof_test.go b/crypto/merkle/simple_proof_test.go new file mode 100644 index 000000000..68e6912fb --- /dev/null +++ b/crypto/merkle/simple_proof_test.go @@ -0,0 +1,41 @@ +package merkle + +import ( + "testing" + + "github.com/stretchr/testify/assert" +) + +func TestSimpleProofValidateBasic(t *testing.T) { + testCases := []struct { + testName string + malleateProof func(*SimpleProof) + errStr string + }{ + {"Good", func(sp *SimpleProof) {}, ""}, + {"Negative Total", func(sp *SimpleProof) { sp.Total = -1 }, "negative Total"}, + {"Negative Index", func(sp *SimpleProof) { sp.Index = -1 }, "negative Index"}, + {"Invalid LeafHash", func(sp *SimpleProof) { sp.LeafHash = make([]byte, 10) }, + "expected LeafHash size to be 32, got 10"}, + {"Too many Aunts", func(sp *SimpleProof) { sp.Aunts = make([][]byte, MaxAunts+1) }, + "expected no more than 100 aunts, got 101"}, + {"Invalid Aunt", func(sp *SimpleProof) { sp.Aunts[0] = make([]byte, 10) }, + "expected Aunts#0 size to be 32, got 10"}, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.testName, func(t *testing.T) { + _, proofs := SimpleProofsFromByteSlices([][]byte{ + []byte("apple"), + []byte("watermelon"), + []byte("kiwi"), + }) + tc.malleateProof(proofs[0]) + err := proofs[0].ValidateBasic() + if tc.errStr != "" { + assert.Contains(t, err.Error(), tc.errStr) + } + }) + } +} diff --git a/crypto/multisig/threshold_pubkey.go b/crypto/multisig/threshold_pubkey.go index 234d420f1..36e2dc2dd 100644 --- a/crypto/multisig/threshold_pubkey.go +++ b/crypto/multisig/threshold_pubkey.go @@ -21,6 +21,11 @@ func NewPubKeyMultisigThreshold(k int, pubkeys []crypto.PubKey) crypto.PubKey { if len(pubkeys) < k { panic("threshold k of n multisignature: len(pubkeys) < k") } + for _, pubkey := range pubkeys { + if pubkey == nil { + panic("nil pubkey") + } + } return PubKeyMultisigThreshold{uint(k), pubkeys} } diff --git a/crypto/multisig/threshold_pubkey_test.go b/crypto/multisig/threshold_pubkey_test.go index d1d7e803c..a707c4b51 100644 --- a/crypto/multisig/threshold_pubkey_test.go +++ b/crypto/multisig/threshold_pubkey_test.go @@ -67,7 +67,11 @@ func TestThresholdMultisigValidCases(t *testing.T) { ) require.NoError( t, - multisignature.AddSignatureFromPubKey(tc.signatures[tc.signingIndices[tc.k]], tc.pubkeys[tc.signingIndices[tc.k]], tc.pubkeys), + multisignature.AddSignatureFromPubKey( + tc.signatures[tc.signingIndices[tc.k]], + tc.pubkeys[tc.signingIndices[tc.k]], + tc.pubkeys, + ), ) require.True( t, diff --git a/crypto/secp256k1/internal/secp256k1/curve.go b/crypto/secp256k1/internal/secp256k1/curve.go index df87200f2..7a2387365 100644 --- a/crypto/secp256k1/internal/secp256k1/curve.go +++ b/crypto/secp256k1/internal/secp256k1/curve.go @@ -41,7 +41,9 @@ import ( /* #include "libsecp256k1/include/secp256k1.h" -extern int secp256k1_ext_scalar_mul(const secp256k1_context* ctx, const unsigned char *point, const unsigned char *scalar); +extern int secp256k1_ext_scalar_mul(const secp256k1_context* ctx, + const unsigned char *point, + const unsigned char *scalar); */ import "C" diff --git a/crypto/secp256k1/secp256k1_test.go b/crypto/secp256k1/secp256k1_test.go index aaf8f8112..a83cd0f5f 100644 --- a/crypto/secp256k1/secp256k1_test.go +++ b/crypto/secp256k1/secp256k1_test.go @@ -94,7 +94,11 @@ func TestGenPrivKeySecp256k1(t *testing.T) { secret []byte }{ {"empty secret", []byte{}}, - {"some long secret", []byte("We live in a society exquisitely dependent on science and technology, in which hardly anyone knows anything about science and technology.")}, + { + "some long secret", + []byte("We live in a society exquisitely dependent on science and technology, " + + "in which hardly anyone knows anything about science and technology."), + }, {"another seed used in cosmos tests #1", []byte{0}}, {"another seed used in cosmos tests #2", []byte("mySecret")}, {"another seed used in cosmos tests #3", []byte("")}, diff --git a/crypto/xchacha20poly1305/vector_test.go b/crypto/xchacha20poly1305/vector_test.go index 3001217f4..f1aa9d66d 100644 --- a/crypto/xchacha20poly1305/vector_test.go +++ b/crypto/xchacha20poly1305/vector_test.go @@ -94,10 +94,29 @@ var vectors = []struct { key, nonce, ad, plaintext, ciphertext []byte }{ { - []byte{0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f}, + []byte{ + 0x80, 0x81, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, + 0x8b, 0x8c, 0x8d, 0x8e, 0x8f, 0x90, 0x91, 0x92, 0x93, 0x94, 0x95, + 0x96, 0x97, 0x98, 0x99, 0x9a, 0x9b, 0x9c, 0x9d, 0x9e, 0x9f, + }, []byte{0x07, 0x00, 0x00, 0x00, 0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b}, []byte{0x50, 0x51, 0x52, 0x53, 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7}, - []byte("Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it."), - []byte{0x45, 0x3c, 0x06, 0x93, 0xa7, 0x40, 0x7f, 0x04, 0xff, 0x4c, 0x56, 0xae, 0xdb, 0x17, 0xa3, 0xc0, 0xa1, 0xaf, 0xff, 0x01, 0x17, 0x49, 0x30, 0xfc, 0x22, 0x28, 0x7c, 0x33, 0xdb, 0xcf, 0x0a, 0xc8, 0xb8, 0x9a, 0xd9, 0x29, 0x53, 0x0a, 0x1b, 0xb3, 0xab, 0x5e, 0x69, 0xf2, 0x4c, 0x7f, 0x60, 0x70, 0xc8, 0xf8, 0x40, 0xc9, 0xab, 0xb4, 0xf6, 0x9f, 0xbf, 0xc8, 0xa7, 0xff, 0x51, 0x26, 0xfa, 0xee, 0xbb, 0xb5, 0x58, 0x05, 0xee, 0x9c, 0x1c, 0xf2, 0xce, 0x5a, 0x57, 0x26, 0x32, 0x87, 0xae, 0xc5, 0x78, 0x0f, 0x04, 0xec, 0x32, 0x4c, 0x35, 0x14, 0x12, 0x2c, 0xfc, 0x32, 0x31, 0xfc, 0x1a, 0x8b, 0x71, 0x8a, 0x62, 0x86, 0x37, 0x30, 0xa2, 0x70, 0x2b, 0xb7, 0x63, 0x66, 0x11, 0x6b, 0xed, 0x09, 0xe0, 0xfd, 0x5c, 0x6d, 0x84, 0xb6, 0xb0, 0xc1, 0xab, 0xaf, 0x24, 0x9d, 0x5d, 0xd0, 0xf7, 0xf5, 0xa7, 0xea}, + []byte( + "Ladies and Gentlemen of the class of '99: If I could offer you only one tip for the future, sunscreen would be it.", + ), + []byte{ + 0x45, 0x3c, 0x06, 0x93, 0xa7, 0x40, 0x7f, 0x04, 0xff, 0x4c, 0x56, + 0xae, 0xdb, 0x17, 0xa3, 0xc0, 0xa1, 0xaf, 0xff, 0x01, 0x17, 0x49, + 0x30, 0xfc, 0x22, 0x28, 0x7c, 0x33, 0xdb, 0xcf, 0x0a, 0xc8, 0xb8, + 0x9a, 0xd9, 0x29, 0x53, 0x0a, 0x1b, 0xb3, 0xab, 0x5e, 0x69, 0xf2, + 0x4c, 0x7f, 0x60, 0x70, 0xc8, 0xf8, 0x40, 0xc9, 0xab, 0xb4, 0xf6, + 0x9f, 0xbf, 0xc8, 0xa7, 0xff, 0x51, 0x26, 0xfa, 0xee, 0xbb, 0xb5, + 0x58, 0x05, 0xee, 0x9c, 0x1c, 0xf2, 0xce, 0x5a, 0x57, 0x26, 0x32, + 0x87, 0xae, 0xc5, 0x78, 0x0f, 0x04, 0xec, 0x32, 0x4c, 0x35, 0x14, + 0x12, 0x2c, 0xfc, 0x32, 0x31, 0xfc, 0x1a, 0x8b, 0x71, 0x8a, 0x62, + 0x86, 0x37, 0x30, 0xa2, 0x70, 0x2b, 0xb7, 0x63, 0x66, 0x11, 0x6b, + 0xed, 0x09, 0xe0, 0xfd, 0x5c, 0x6d, 0x84, 0xb6, 0xb0, 0xc1, 0xab, + 0xaf, 0x24, 0x9d, 0x5d, 0xd0, 0xf7, 0xf5, 0xa7, 0xea, + }, }, } diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 70b404c42..8ede2f8cc 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -1,141 +1,145 @@ module.exports = { - title: "Tendermint Documentation", - description: "Documentation for Tendermint Core.", - ga: "UA-51029217-1", - dest: "./dist/docs", - base: "/docs/", - markdown: { - lineNumbers: true - }, + theme: "cosmos", + // locales: { + // "/": { + // lang: "en-US" + // }, + // "/ru/": { + // lang: "ru" + // } + // }, + base: process.env.VUEPRESS_BASE, themeConfig: { - repo: "tendermint/tendermint", + docsRepo: "tendermint/tendermint", editLinks: true, docsDir: "docs", - docsBranch: "develop", - editLinkText: 'Edit this page on Github', - lastUpdated: true, - algolia: { - apiKey: '59f0e2deb984aa9cdf2b3a5fd24ac501', - indexName: 'tendermint', - debug: false + logo: "/logo.svg", + label: "core", + gutter: { + title: "Help & Support", + editLink: true, + chat: { + title: "Riot Chat", + text: "Chat with Tendermint developers on Riot Chat.", + url: "https://riot.im/app/#/room/#tendermint:matrix.org", + bg: "#222" + }, + forum: { + title: "Tendermint Forum", + text: "Join the Tendermint forum to learn more", + url: "https://forum.cosmos.network/c/tendermint", + bg: "#0B7E0B", + logo: "tendermint" + }, + github: { + title: "Found an Issue?", + text: "Help us improve this page by suggesting edits on GitHub." + } + }, + footer: { + logo: "/logo-bw.svg", + textLink: { + text: "tendermint.com", + url: "https://tendermint.com" + }, + services: [ + { + service: "medium", + url: "https://medium.com/@tendermint" + }, + { + service: "twitter", + url: "https://twitter.com/tendermint_team" + }, + { + service: "linkedin", + url: "https://www.linkedin.com/company/tendermint/" + }, + { + service: "reddit", + url: "https://reddit.com/r/cosmosnetwork" + }, + { + service: "telegram", + url: "https://t.me/cosmosproject" + }, + { + service: "youtube", + url: "https://www.youtube.com/c/CosmosProject" + } + ], + smallprint: + "The development of the Tendermint project is led primarily by Tendermint Inc., the for-profit entity which also maintains this website. Funding for this development comes primarily from the Interchain Foundation, a Swiss non-profit.", + links: [ + { + title: "Documentation", + children: [ + { + title: "Cosmos SDK", + url: "https://cosmos.network/docs" + }, + { + title: "Cosmos Hub", + url: "https://hub.cosmos.network/" + } + ] + }, + { + title: "Community", + children: [ + { + title: "Tendermint blog", + url: "https://medium.com/@tendermint" + }, + { + title: "Forum", + url: "https://forum.cosmos.network/c/tendermint" + }, + { + title: "Chat", + url: "https://riot.im/app/#/room/#tendermint:matrix.org" + } + ] + }, + { + title: "Contributing", + children: [ + { + title: "Contributing to the docs", + url: "https://github.com/tendermint/tendermint" + }, + { + title: "Source code on GitHub", + url: "https://github.com/tendermint/tendermint" + }, + { + title: "Careers at Tendermint", + url: "https://tendermint.com/careers" + } + ] + } + ] }, - nav: [ - { text: "Back to Tendermint", link: "https://tendermint.com" }, - { text: "RPC", link: "https://tendermint.com/rpc/" } - ], sidebar: [ { - title: "Introduction", - collapsable: false, + title: "Resources", children: [ - "/introduction/", - "/introduction/quick-start", - "/introduction/install", - "/introduction/what-is-tendermint" - ] - }, - { - title: "Guides", - collapsable: false, - children: [ - "/guides/go-built-in", - "/guides/go" - ] - }, - { - title: "Apps", - collapsable: false, - children: [ - "/app-dev/getting-started", - "/app-dev/abci-cli", - "/app-dev/app-architecture", - "/app-dev/app-development", - "/app-dev/subscribing-to-events-via-websocket", - "/app-dev/indexing-transactions", - "/spec/abci/abci", - "/app-dev/ecosystem" - ] - }, - { - title: "Tendermint Core", - collapsable: false, - children: [ - "/tendermint-core/", - "/tendermint-core/using-tendermint", - "/tendermint-core/configuration", - "/tendermint-core/rpc", - "/tendermint-core/running-in-production", - "/tendermint-core/fast-sync", - "/tendermint-core/how-to-read-logs", - "/tendermint-core/block-structure", - "/tendermint-core/light-client-protocol", - "/tendermint-core/metrics", - "/tendermint-core/secure-p2p", - "/tendermint-core/validators", - "/tendermint-core/mempool" - ] - }, - { - title: "Networks", - collapsable: false, - children: [ - "/networks/", - "/networks/docker-compose", - "/networks/terraform-and-ansible", - ] - }, - { - title: "Tools", - collapsable: false, - children: [ - "/tools/", - "/tools/benchmarking", - "/tools/monitoring", - "/tools/remote-signer-validation" - ] - }, - { - title: "Tendermint Spec", - collapsable: true, - children: [ - "/spec/", - "/spec/blockchain/blockchain", - "/spec/blockchain/encoding", - "/spec/blockchain/state", - "/spec/software/abci", - "/spec/consensus/bft-time", - "/spec/consensus/consensus", - "/spec/consensus/light-client", - "/spec/software/wal", - "/spec/p2p/config", - "/spec/p2p/connection", - "/spec/p2p/node", - "/spec/p2p/peer", - "/spec/reactors/block_sync/reactor", - "/spec/reactors/block_sync/impl", - "/spec/reactors/consensus/consensus", - "/spec/reactors/consensus/consensus-reactor", - "/spec/reactors/consensus/proposer-selection", - "/spec/reactors/evidence/reactor", - "/spec/reactors/mempool/concurrency", - "/spec/reactors/mempool/config", - "/spec/reactors/mempool/functionality", - "/spec/reactors/mempool/messages", - "/spec/reactors/mempool/reactor", - "/spec/reactors/pex/pex", - "/spec/reactors/pex/reactor", - ] - }, - { - title: "ABCI Spec", - collapsable: false, - children: [ - "/spec/abci/", - "/spec/abci/abci", - "/spec/abci/apps", - "/spec/abci/client-server" + { + title: "Developer Sessions", + path: "/DEV_SESSIONS.html" + }, + { + title: "RPC", + path: "/rpc/", + static: true + } ] } ] + }, + markdown: { + anchor: { + permalinkSymbol: "" + } } }; diff --git a/docs/.vuepress/dist/404.html b/docs/.vuepress/dist/404.html deleted file mode 100644 index 6249309b0..000000000 --- a/docs/.vuepress/dist/404.html +++ /dev/null @@ -1,17 +0,0 @@ - - -
- - -